禁止:Bot 已被用户阻止 - laravel irazasyed/telegram-bot-sdk
Forbidden: Bot was blocked by the user - laravel irazasyed/telegram-bot-sdk
最近我遇到了很多这样的异常:
[2020-07-21 00:00:51] local.ERROR: Forbidden: bot was blocked by the user {"exception":"[object] (Telegram\Bot\Exceptions\TelegramResponseException(code: 403): Forbidden: bot was blocked by the user at /home/birjande/public_html/tel.birjandelectronic.shop/packages/irazasyed/telegram-bot-sdk/src/Exceptions/TelegramResponseException.php:58)
在我的情况下,当用户阻止 botm 时,我的机器人在无限循环中失败并一次又一次地发送消息!
我得到的是这种还是错误,正好10000次!
事实上,如果我遇到错误,它会重复 1000 多次!
我使用 laravel 6 和 irazasyed/telegram-bot-sdk
我这样创建自己的 sendMessage
public function sendMessage($arr) {
try {
Telegram::sendMessage($arr);
} catch (TelegramResponseException $e) {
return "user has been blocked!";
}
}
最近我遇到了很多这样的异常:
[2020-07-21 00:00:51] local.ERROR: Forbidden: bot was blocked by the user {"exception":"[object] (Telegram\Bot\Exceptions\TelegramResponseException(code: 403): Forbidden: bot was blocked by the user at /home/birjande/public_html/tel.birjandelectronic.shop/packages/irazasyed/telegram-bot-sdk/src/Exceptions/TelegramResponseException.php:58)
在我的情况下,当用户阻止 botm 时,我的机器人在无限循环中失败并一次又一次地发送消息!
我得到的是这种还是错误,正好10000次!
事实上,如果我遇到错误,它会重复 1000 多次!
我使用 laravel 6 和 irazasyed/telegram-bot-sdk
我这样创建自己的 sendMessage
public function sendMessage($arr) {
try {
Telegram::sendMessage($arr);
} catch (TelegramResponseException $e) {
return "user has been blocked!";
}
}