1
0
mirror of https://github.com/civsocit/olgram.git synced 2025-12-19 08:36:17 +00:00

регистрация токенов

This commit is contained in:
mihalin
2021-09-09 20:38:33 +03:00
parent 869df66cd3
commit bf7c18c076
4 changed files with 50 additions and 0 deletions

View File

@@ -11,6 +11,7 @@ from textwrap import dedent
from olgram.models.models import Bot, User
from olgram.settings import OlgramSettings
from olgram.commands.menu import send_bots_menu
from server.server import register_token
from olgram.router import dp
@@ -94,6 +95,9 @@ async def bot_added(message: types.Message, state: FSMContext):
except TelegramAPIError:
return await on_unknown_error()
if not register_token(token):
return await on_unknown_error()
user, _ = await User.get_or_create(telegram_id=message.from_user.id)
bot = Bot(token=token, owner=user, name=test_bot_info.username, super_chat_id=message.from_user.id)
try: