Disable chat in morning greet list if chat id is not found

This commit is contained in:
eleksir
2022-12-15 02:19:01 +03:00
parent 6e084995a7
commit f6a5a05e58
2 changed files with 9 additions and 3 deletions

View File

@@ -77,12 +77,17 @@ sub redis_parse_message {
return;
}
unless (defined $j->{migrate_to_chat_id}) {
if (defined $j->{migrate_to_chat_id}) {
MigrateSettingsToNewChatID ($m->{chatid}, $j->{migrate_to_chat_id});
} elsif (defined ($j->{message}) && $j->{message} eq 'Bad Request: chat not found') {
if (defined $j->{param}->{chat_id}) {
FortuneToggle ($j->{param}->{chat_id}, 0);
}
} else {
$log->error("An error occured while sending message to chat $m->{chatid}");
return;
}
MigrateSettingsToNewChatID ($m->{chatid}, $j->{migrate_to_chat_id});
$message->{chat_id} = $j->{migrate_to_chat_id};
$r = undef;

View File

@@ -756,6 +756,7 @@ sub _post_request {
$result->{message} = $res->content->asset->content;
$result->{http_code} = $res->code;
$result->{param} = $form_args;
return $result; # to handle this in upper layers
}