-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcro_bot.py
More file actions
40 lines (30 loc) · 1.18 KB
/
cro_bot.py
File metadata and controls
40 lines (30 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import os
import logging
from dotenv import load_dotenv
from aiogram import Bot, Dispatcher
from handlers import start_command, restart_command, word_handler, \
stat_command, help_command, chat_command, backup_command
from callbacks import start_callback, restart_callback, word_callback
dotenv_path = os.path.join(os.path.dirname(__file__), '.env')
if os.path.exists(dotenv_path):
load_dotenv(dotenv_path)
TOKEN = os.getenv('TOKEN')
logging.basicConfig( level=logging.WARNING, filename="cro_log.log",
format="[%(asctime)s] %(levelname)s %(message)s"
)
def main() -> None:
bot = Bot(TOKEN, parse_mode="HTML")
dp = Dispatcher()
dp.include_router(start_command.router)
dp.include_router(restart_command.router)
dp.include_router(stat_command.router)
dp.include_router(help_command.router)
dp.include_router(chat_command.router)
dp.include_router(start_callback.router)
dp.include_router(backup_command.router)
dp.include_router(restart_callback.router)
dp.include_router(word_handler.router)
dp.include_router(word_callback.router)
dp.run_polling(bot)
if __name__ == "__main__":
main()