This repository has been archived on 2022-10-22. You can view files and clone it, but cannot push or open issues or pull requests.
it-volunteers-for-peace/bot.py

27 lines
522 B
Python
Raw Normal View History

2022-09-16 05:48:10 +00:00
#!/usr/bin/python
2022-10-15 14:52:45 +00:00
import logging
import os
2022-09-16 05:48:10 +00:00
import asyncio
2022-10-15 14:52:45 +00:00
from aiogram import Bot, Dispatcher
2022-09-16 05:48:10 +00:00
async def main():
2022-10-15 14:52:45 +00:00
"""Configures and runs the bot, connects to the db"""
logging.basicConfig(level=logging.INFO)
API_TOKEN = os.getenv("API_TOKEN")
bot = Bot(API_TOKEN)
dp = Dispatcher(bot)
try:
await dp.start_polling()
finally:
await dp.storage.close()
await dp.storage.wait_closed()
await bot.session.close()
2022-09-16 05:48:10 +00:00
if __name__ == '__main__':
asyncio.run(main())