Exemplo n.º 1
0
async def start(event):
    try:
        user_info = await bot.get_entity(event.original_update.message.peer_id)
        user = User(user_info.id, user_info.username, '', '')
        users.add_user(user)
        msg = await event.respond(welcome_text,
                                  buttons=welcome_keyboard,
                                  parse_mode=html)
        user.add_message(msg.id)
    except Exception:
        print('Ошибка:\n', traceback.format_exc())
Exemplo n.º 2
0
async def start(event):
    try:
        user_info = await bot.get_entity(event.original_update.message.peer_id)
        user = users.get_user(user_info.id)
        msg = await event.respond('Возвращаемся в начало',
                                  buttons=Button.clear())
        user.add_message(msg)
        user.add_user_message(event.message.id)
        await user.delete_all_messages()
        user_info = await bot.get_entity(event.original_update.message.peer_id)
        user = User(user_info.id, user_info.username, '', '')
        users.add_user(user)
        msg = await event.respond(welcome_text, buttons=welcome_keyboard)
        user.add_message(msg)
    except Exception:
        print('Ошибка:\n', traceback.format_exc())