diff --git a/lib/RedisLib.pm b/lib/RedisLib.pm index 27f8059..a0f200b 100644 --- a/lib/RedisLib.pm +++ b/lib/RedisLib.pm @@ -77,12 +77,17 @@ sub redis_parse_message { return; } - unless (defined $j->{migrate_to_chat_id}) { - $log->error ("An error occured while sending message to chat $m->{chatid}"); + 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; diff --git a/lib/Teapot/Bot/Brain.pm b/lib/Teapot/Bot/Brain.pm index 37ebbb9..715503c 100644 --- a/lib/Teapot/Bot/Brain.pm +++ b/lib/Teapot/Bot/Brain.pm @@ -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 }