def set_hook(): import asyncio from bot.settings import HEROKU_APP_NAME, WEBHOOK_URL, BOT_TOKEN from aiogram import Bot bot = Bot(token=BOT_TOKEN) async def hook_set(): await bot.set_webhook(WEBHOOK_URL) print(await bot.get_webhook_info()) asyncio.run(hook_set()) bot.close()
def set_hook(): import asyncio from bot.settings import HEROKU_APP_NAME, WEBHOOK_URL, TELEGRAM_BOT from aiogram import Bot bot = Bot(token=TELEGRAM_BOT) async def hook_set(): if not HEROKU_APP_NAME: print('You have forgot to set HEROKU_APP_NAME') quit() await bot.set_webhook(WEBHOOK_URL) print(await bot.get_webhook_info()) asyncio.run(hook_set()) bot.close()
def set_hook(): import asyncio from project.Telegram_Chatbot.settings import HEROKU_APP_NAME, WEBHOOK_URL, BOT_TOKEN from aiogram import Bot bot = Bot(token=BOT_TOKEN) async def hook_set(): if not HEROKU_APP_NAME: print('You have forgot to set HEROKU_APP_NAME') quit() await bot.set_webhook(WEBHOOK_URL) print(await bot.get_webhook_info()) asyncio.run(hook_set()) bot.close()
def set_hook(): import asyncio from data.config import HEROKU_APP_NAME, WEBHOOK_URL, BOT_TOKEN from aiogram import Bot import logging bot = Bot(token=BOT_TOKEN) async def hook_set(): if not HEROKU_APP_NAME: logging.info('Вы не становили параметр HEROKU_APP_NAME') quit() await bot.set_webhook(WEBHOOK_URL) logging.info('Какая та инфа по вебхуку: ' + await bot.get_webhook_info()) asyncio.run(hook_set()) bot.close()
def publish(self, channel_name='ready'): signal(SIGINT, interrupt_handler) try: loop = uvloop.new_event_loop() bot = Bot(token=getenv('TELEGRAM_KEY'), loop=loop) task = loop.create_task(subscribe_and_listen(bot, channel_name)) loop.run_until_complete(task) finally: task.cancel() loop.run_until_complete(bot.close()) loop.close()