コード例 #1
0
ファイル: app.py プロジェクト: s1veme/counterBot
async def on_startup(dispatcher):
    await on_startup_notify(dispatcher)

    try:
        db.create_table_users()
    except Exception as err:
        logger.error(err)
コード例 #2
0
async def on_startup(dp):
    # Установка фильтров и мидлварей
    filters.setup(dp)
    middlewares.setup(dp)

    # создаем бд юзера
    try:
        db.create_table_users()
    except Exception as error:
        print(f'Error = {error}')
    # Чистим БД юзеров
    # db.delete_all_users()

    # создаем бд фотки
    try:
        photo_db.create_table_photos()
    except Exception as error:
        print(f'Error = {error}')
    # Чистим БД фоток
    # photo_db.delete_all_photos()
    # вносим изначально в бд фотки
    # do_db_photo(photo_db)
    print('\nПользователи = ', db.select_all_users())
    print('--------------')
    print('\nФоточки = ', photo_db.select_all_photos())
    # отправка сообщения админам
    await on_startup_notify(dp)
コード例 #3
0
async def on_startup(dp):
    import filters
    import middlewares
    filters.setup(dp)
    middlewares.setup(dp)

    try:
        db.create_table_users()
    except Exception as e:
        print(e)
    await set_default_commands(dp)
コード例 #4
0
async def on_startup(dispatcher):
    # Birlamchi komandalar (/star va /help)
    await set_default_commands(dispatcher)

    # Ma'lumotlar bazasini yaratamiz:
    try:
        db.create_table_users()
    except Exception as err:
        print(err)

    # Bot ishga tushgani haqida adminga xabar berish
    await on_startup_notify(dispatcher)
コード例 #5
0
async def on_startup(dp):
    import filters
    import middlewares
    filters.setup(dp)
    middlewares.setup(dp)

    from utils.notify_admins import on_startup_notify
    try:
        db.create_table_users()
    except Exception as e:
        print(e)
    db.delete_users()

    await on_startup_notify(dp)
コード例 #6
0
async def on_startup(dp):
    import filters
    import middlewares
    filters.setup(dp)
    middlewares.setup(dp)

    from utils.notify_admins import on_startup_notify
    try:
        db.create_table_users()
        db.create_table_gazzetta()
        db.create_table_sent_messages()
    except Exception as err:
        print(err)
    await on_startup_notify(dp)
    await set_default_commands(dp)
コード例 #7
0
ファイル: app.py プロジェクト: exelay/carspass_bot
async def on_startup(dp):
    logger.add('debug.log',
               level='DEBUG',
               rotation='100 KB',
               compression='zip')
    logger.info('Creating tables...')
    try:
        db.create_table_users()
        logger.info('Table successfully created!')
    except OperationalError:
        logger.info('Table already exists!')
    except Exception as err:
        logger.error(f'Table creation error: {err}')

    await set_default_commands(dp)
コード例 #8
0
ファイル: app.py プロジェクト: TwoThousandGit/financial-bot
async def on_startup(dp):
    import filters
    import middlewares
    filters.setup(dp)
    middlewares.setup(dp)

    from utils.notify_admins import on_startup_notify
    try:
        db.create_table_users()
    except Exception as e:
        print(e)
    #db.delete_users()
    print(db.select_all_users())

    await on_startup_notify(dp)
    await set_default_commands(dp)
コード例 #9
0
async def on_startup(dp):
    import filters
    import middlewares
    filters.setup(dp)
    middlewares.setup(dp)

    from utils.notify_admins import admin_notify
    try:
        db.create_table_users()
    except Exception as e:
        print(e)
    try:
        db.create_item_table()
    except Exception as e:
        print(e)
    await set_default_commands(dp)
    print(db.select_all_items())
    print(db.select_all_users())
    await admin_notify(dp, "Бот запущен!")
コード例 #10
0
async def on_startup(dispatcher):
    schedule_jobs()  # Запуск планировшика задач

    # Переустанавливаем Вебхук
    logger.warning('Starting connection...')
    if WEBHOOK:
        await bot.delete_webhook()
        await bot.set_webhook(WEBHOOK_URL, drop_pending_updates=True, max_connections=100)

    # Устанавливаем дефолтные команды
    await set_default_commands(dispatcher)

    # Уведомляем про запуск
    await notify_admins()

    try:
        db.create_table_users()  # создаем БД если отсутствует
    except Exception as err:
        print(err)

    logger.info("Bot started successfully")