Adding /about and /donate.
This commit is contained in:
parent
3e93c4dc0d
commit
bca8c0c8d1
@ -28,7 +28,8 @@ $telegram->set_my_commands(
|
|||||||
commands => [
|
commands => [
|
||||||
{
|
{
|
||||||
command => 'karma',
|
command => 'karma',
|
||||||
description => 'Shows your karma or the one of the user you are replying to',
|
description =>
|
||||||
|
'Shows your karma or the one of the user you are replying to',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
command => 'doctortop',
|
command => 'doctortop',
|
||||||
@ -37,6 +38,15 @@ $telegram->set_my_commands(
|
|||||||
{
|
{
|
||||||
command => 'doctorhate',
|
command => 'doctorhate',
|
||||||
description => 'Shows the most hated users.',
|
description => 'Shows the most hated users.',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
command => 'about',
|
||||||
|
description =>
|
||||||
|
'Shows license information, author and where to find the code.',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
command => 'donate',
|
||||||
|
description => 'Shows how to donate',
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
@ -98,12 +108,54 @@ sub process_message_with_text {
|
|||||||
show_top_ten_hate($message);
|
show_top_ten_hate($message);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if ( $text =~ m{^/about(?:@\w+)?$} ) {
|
||||||
|
show_about($message);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ( $text =~ m{^/donate(?:@\w+)?$} ) {
|
||||||
|
show_donate($message);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if ( defined $reply_to_message && $text =~ /^(?:-|\+)\d+$/ ) {
|
if ( defined $reply_to_message && $text =~ /^(?:-|\+)\d+$/ ) {
|
||||||
error_too_much_karma($message);
|
error_too_much_karma($message);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub show_donate {
|
||||||
|
my $message =shift;
|
||||||
|
my $chat_id = $message->{chat}{id};
|
||||||
|
|
||||||
|
my $html = <<'EOF';
|
||||||
|
You can donate btc using the following bitcoin address:
|
||||||
|
bc1qtas98jqjglezqtz5es8cpg0h72qquc4h83e0gz
|
||||||
|
EOF
|
||||||
|
$telegram->send_message(
|
||||||
|
chat_id => $chat_id,
|
||||||
|
text => $html
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
sub show_about {
|
||||||
|
my $message = shift;
|
||||||
|
my $chat_id = $message->{chat}{id};
|
||||||
|
|
||||||
|
my $html = <<'EOF';
|
||||||
|
This bot is free software licensed under the <b>AGPLv3</b>.
|
||||||
|
|
||||||
|
You can grab a copy of the source code at:
|
||||||
|
<a href="https://gitea.sergiotarxz.freemyip.com/sergiotarxz/DoctorKarma">https://gitea.sergiotarxz.freemyip.com/sergiotarxz/DoctorKarma</a>
|
||||||
|
|
||||||
|
If you want to contribute contact with @sergiotarxz.
|
||||||
|
|
||||||
|
If you are interested in donate use the /donate command.
|
||||||
|
EOF
|
||||||
|
$telegram->send_message(
|
||||||
|
chat_id => $chat_id,
|
||||||
|
text => $html,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
sub error_too_much_karma {
|
sub error_too_much_karma {
|
||||||
my $message = shift;
|
my $message = shift;
|
||||||
my $chat_id = $message->{chat}{id};
|
my $chat_id = $message->{chat}{id};
|
||||||
@ -135,6 +187,7 @@ sub show_top_ten_hate {
|
|||||||
text => $html
|
text => $html
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
sub show_top_ten {
|
sub show_top_ten {
|
||||||
my $message = shift;
|
my $message = shift;
|
||||||
my $chat_id = $message->{chat}{id};
|
my $chat_id = $message->{chat}{id};
|
||||||
|
Loading…
Reference in New Issue
Block a user