Fix: Solucionados problemas de permisos en Docker y agregada gestion de Webhook de Telegram

This commit is contained in:
2026-04-19 19:23:25 -06:00
parent 249c997257
commit c4bd4b62e3
13 changed files with 615 additions and 98 deletions

View File

@@ -297,4 +297,40 @@ class TelegramBotService
return false;
}
}
/**
* Obtener información del webhook
*/
public function getWebhookInfo(): array
{
if (!$this->botToken) {
return ['ok' => false, 'error' => 'Bot token not configured'];
}
try {
$response = Http::get("https://api.telegram.org/bot{$this->botToken}/getWebhookInfo");
return $response->json();
} catch (\Exception $e) {
Log::error('Telegram get webhook info error', ['error' => $e->getMessage()]);
return ['ok' => false, 'error' => $e->getMessage()];
}
}
/**
* Borrar webhook
*/
public function deleteWebhook(): bool
{
if (!$this->botToken) {
return false;
}
try {
$response = Http::post("https://api.telegram.org/bot{$this->botToken}/deleteWebhook");
return $response->json('ok', false);
} catch (\Exception $e) {
Log::error('Telegram delete webhook error', ['error' => $e->getMessage()]);
return false;
}
}
}