написана точка входа бота, конфиг, добавлена зависимость PyYAML

This commit is contained in:
ilyazheprog
2023-11-30 20:23:37 +07:00
parent 0d614cee69
commit bc5de691a7
6 changed files with 86 additions and 1 deletions

4
src/core/config.py Normal file
View File

@@ -0,0 +1,4 @@
import yaml
with open('config.yaml', 'r') as file:
yaml_load = yaml.full_load(file)

2
src/core/config.yaml Normal file
View File

@@ -0,0 +1,2 @@
TELEGRAM:
TOKEN: xxxxxxxxxxxxxxxxxxxx

19
src/core/main.py Normal file
View File

@@ -0,0 +1,19 @@
from .config import yaml_load
from asyncio import run
from aiogram import Bot, Dispatcher
async def main():
try:
bot = Bot(token=yaml_load["TELEGRAM"]["TOKEN"])
dp = Dispatcher()
await dp.start_polling(bot)
finally:
await bot.session.close()
if __name__ == "__main__":
run(main())