diff --git a/bin/doctor_karma.pl b/bin/doctor_karma.pl
index a9008b7..a2787cd 100755
--- a/bin/doctor_karma.pl
+++ b/bin/doctor_karma.pl
@@ -27,16 +27,26 @@ my $db = DoctorKarma::DB->dbh;
$telegram->set_my_commands(
commands => [
{
- command => 'karma',
- description => 'Shows your karma or the one of the user you are replying to',
+ command => 'karma',
+ description =>
+ 'Shows your karma or the one of the user you are replying to',
},
{
- command => 'doctortop',
+ command => 'doctortop',
description => 'Shows the most popular users.',
},
{
- command => 'doctorhate',
+ command => 'doctorhate',
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,16 +108,58 @@ sub process_message_with_text {
show_top_ten_hate($message);
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+$/ ) {
error_too_much_karma($message);
return;
}
}
-sub error_too_much_karma {
- my $message = shift;
+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 AGPLv3.
+
+You can grab a copy of the source code at:
+https://gitea.sergiotarxz.freemyip.com/sergiotarxz/DoctorKarma
+
+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 {
+ my $message = shift;
+ my $chat_id = $message->{chat}{id};
+
$telegram->send_message(
chat_id => $chat_id,
text => 'You cannoct substract or add more than 1 of karma.',
@@ -135,6 +187,7 @@ sub show_top_ten_hate {
text => $html
);
}
+
sub show_top_ten {
my $message = shift;
my $chat_id = $message->{chat}{id};