import asyncio import os import telegram import yaml with open(os.path.join('configs', 'telegram.yml'), 'r') as file: config = yaml.safe_load(file.read()) bot = telegram.Bot(config['token']) def send_message(text): asyncio.run(async_send_message(text)) async def async_send_message(text): async with bot: await bot.send_message(text=text, chat_id=config['chat_id']) async def init_bot(): async with bot: print(await bot.get_me()) asyncio.run(init_bot())