1
0
mirror of https://github.com/civsocit/olgram.git synced 2025-12-16 20:16:16 +00:00

minor changes

This commit is contained in:
mihalin
2021-09-22 21:17:26 +03:00
parent 04a3efd3fb
commit 5cf69e3ea9
6 changed files with 9 additions and 5 deletions

View File

@@ -2,7 +2,7 @@
Здесь работа с конкретным ботом
"""
from aiogram import types
from aiogram.utils.exceptions import TelegramAPIError
from aiogram.utils.exceptions import TelegramAPIError, Unauthorized
from olgram.models.models import Bot
from server.server import unregister_token
@@ -11,7 +11,11 @@ async def delete_bot(bot: Bot, call: types.CallbackQuery):
"""
Пользователь решил удалить бота
"""
await unregister_token(bot.token)
try:
await unregister_token(bot.token)
except Unauthorized:
# Вероятно пользователь сбросил токен или удалил бот, это уже не наши проблемы
pass
await bot.delete()
await call.answer("Бот удалён")
try: