Adding a better error handling.
This commit is contained in:
parent
be6c2f2201
commit
acbdaefba7
@ -55,22 +55,24 @@ my @commands = (
|
||||
description => 'Shows this help.',
|
||||
}
|
||||
);
|
||||
$telegram->set_my_commands( commands => [@commands] );
|
||||
|
||||
my $i = 0;
|
||||
while (1) {
|
||||
eval {
|
||||
$telegram->set_my_commands( commands => [@commands] ) if $i == 0;
|
||||
my $updates = $telegram->get_updates;
|
||||
for my $update ( $updates->@* ) {
|
||||
eval {
|
||||
my $message = $update->{message};
|
||||
if ( defined $message ) {
|
||||
proccess_new_message($message);
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
};
|
||||
if ($@) {
|
||||
$logger->log_error($@);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub proccess_new_message {
|
||||
my $message = shift;
|
||||
@ -148,7 +150,8 @@ sub check_can_modify_karma {
|
||||
return 1;
|
||||
}
|
||||
my $last_karma_given_date = $user->last_karma_given_date;
|
||||
my $time_to_post = $last_karma_given_date->add(minutes => 1) - DateTime->now();
|
||||
my $time_to_post =
|
||||
$last_karma_given_date->add( minutes => 1 ) - DateTime->now();
|
||||
$telegram->send_message(
|
||||
chat_id => $chat_id,
|
||||
text => "You cannot give karma yet wait a bit.
|
||||
|
Loading…
Reference in New Issue
Block a user