|
|
@@ -12,7 +12,7 @@ use Telegram\Bot\Api;
|
|
|
use Illuminate\Support\Facades\Log;
|
|
|
use App\Services\BaseService;
|
|
|
use DragonCode\PrettyArray\Services\Formatters\Base;
|
|
|
-
|
|
|
+use Telegram\Bot\Exceptions\TelegramResponseException;
|
|
|
class SendTelegramGroupMessageJob implements ShouldQueue
|
|
|
{
|
|
|
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
|
|
@@ -45,20 +45,18 @@ class SendTelegramGroupMessageJob implements ShouldQueue
|
|
|
|
|
|
try {
|
|
|
BaseService::bettingGroupNotice($this->text, $this->buttons, $this->image, $this->isTop, $this->separator);
|
|
|
- } catch (\Telegram\Bot\Exceptions\TelegramResponseException $e) {
|
|
|
- // // 捕获 Too Many Requests
|
|
|
- // if (str_contains($e->getMessage(), 'Too Many Requests')) {
|
|
|
- // preg_match('/retry after (\d+)/', $e->getMessage(), $matches);
|
|
|
- // $retryAfter = $matches[1] ?? 5;
|
|
|
- // Log::warning("Telegram 429 限制,等待 {$retryAfter} 秒重试...");
|
|
|
- // sleep($retryAfter + 1);
|
|
|
-
|
|
|
- // // 重试
|
|
|
- // $this->handle();
|
|
|
- // } else {
|
|
|
- Log::error('Telegram 消息发送失败: ' . $e->getMessage());
|
|
|
- Log::error("失败消息: \n" . $this->text);
|
|
|
- // }
|
|
|
+ } catch (TelegramResponseException $e) {
|
|
|
+
|
|
|
+ try {
|
|
|
+ BaseService::bettingGroupNotice($this->text, $this->buttons, $this->image, $this->isTop, $this->separator);
|
|
|
+ }catch (TelegramResponseException $e){
|
|
|
+ try {
|
|
|
+ BaseService::bettingGroupNotice($this->text, $this->buttons, $this->image, $this->isTop, $this->separator);
|
|
|
+ }catch (TelegramResponseException $e){
|
|
|
+ Log::error('Telegram 消息发送失败: ' . $e->getMessage());
|
|
|
+ Log::error("失败消息: \n" . $this->text);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|