Adding error message when trying to add more than 1 of karma.
This commit is contained in:
parent
16e8006374
commit
2ec3e34326
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user