Adding error message when trying to add more than 1 of karma.

This commit is contained in:
sergiotarxz 2022-02-09 18:07:53 +01:00
parent 16e8006374
commit 2ec3e34326
1 changed files with 19 additions and 0 deletions

View File

@ -64,19 +64,38 @@ sub process_message_with_text {
"'$message->{text}' received from $first_name:$log_username:$user_id");
if ( $text eq '+1' && defined $reply_to_message ) {
add_karma_to_replied_message_user($message);
return;
}
if ( $text eq '-1' && defined $reply_to_message ) {
substract_karma_to_replied_message_user($message);
return;
}
if ( $text eq '/karma' ) {
show_karma($message);
return;
}
if ( $text eq '/doctortop' ) {
show_top_ten($message);
return;
}
if ( $text eq '/doctorhate' ) {
show_top_ten_hate($message);
return;
}
if ( $text =~ /^(?:-|\+)\d+$/ ) {
error_too_much_karma($message);
return;
}
}
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.',
);
}
sub show_top_ten_hate {