More strict check of redis message json format
This commit is contained in:
@@ -37,7 +37,13 @@ sub redis_parse_message {
|
|||||||
$message->{parse_mode} = 'Markdown';
|
$message->{parse_mode} = 'Markdown';
|
||||||
}
|
}
|
||||||
|
|
||||||
$message->{chat_id} = 0 + $m->{chatid};
|
$message->{chat_id} = eval { 0 + $m->{chatid}; };
|
||||||
|
|
||||||
|
unless (defined $message->{chat_id}) {
|
||||||
|
log->error ('Incoming redis message is incorrect: chat id must be numeric value!');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$message->{text} = "$m->{message}";
|
$message->{text} = "$m->{message}";
|
||||||
|
|
||||||
my $can_talk = Teapot::Bot::Object::ChatPermissions->canTalk ($main::TGM, 0 + $m->{chatid});
|
my $can_talk = Teapot::Bot::Object::ChatPermissions->canTalk ($main::TGM, 0 + $m->{chatid});
|
||||||
|
|||||||
@@ -71,6 +71,10 @@ sub __cron {
|
|||||||
if ($hour == 8 && ($min >= 0 && $min <= 14)) {
|
if ($hour == 8 && ($min >= 0 && $min <= 14)) {
|
||||||
foreach my $enabledfortunechat (FortuneToggleList ()) {
|
foreach my $enabledfortunechat (FortuneToggleList ()) {
|
||||||
# Set it to strings, explicitly
|
# Set it to strings, explicitly
|
||||||
|
next unless (defined $enabledfortunechat);
|
||||||
|
next if ("$enabledfortunechat" eq '');
|
||||||
|
next if ("$enabledfortunechat" eq '0');
|
||||||
|
|
||||||
$rmsg->{userid} = "$enabledfortunechat";
|
$rmsg->{userid} = "$enabledfortunechat";
|
||||||
$rmsg->{chatid} = "$enabledfortunechat";
|
$rmsg->{chatid} = "$enabledfortunechat";
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user