This commit is contained in:
2023-06-24 14:17:08 +03:00
commit b76a377f2d
14 changed files with 884 additions and 0 deletions

1
bot_lib/__init__.py Normal file
View File

@@ -0,0 +1 @@
from bot_lib import bot_create, settings

19
bot_lib/bot_create.py Normal file
View File

@@ -0,0 +1,19 @@
from aiogram.contrib.fsm_storage.memory import MemoryStorage
from aiogram.utils.callback_data import CallbackData
from loguru import logger
from aiogram import Bot, Dispatcher
from bot_lib.settings import TELEGRAM_TOKEN
logger.add('logs/bot.log', format='{time:DD-MM-YY HH:mm:ss} - {level} - {message}', level='INFO', rotation='1 week',
compression='zip')
# CallbackData factory
some_cb = CallbackData('callback_name', 'action')
bot = Bot(token=TELEGRAM_TOKEN, parse_mode='HTML')
storage = MemoryStorage()
# TODO: replace MemoryStorage to another stateful storage
dp = Dispatcher(bot, storage=storage)

17
bot_lib/settings.py Normal file
View File

@@ -0,0 +1,17 @@
# -*- coding: utf-8 -*-
# =================================================================================================
# CONFIGURATION FOR TELEGRAM BOT
# =================================================================================================
TELEGRAM_TOKEN = 'TOKEN'
# =================================================================================================
# MESSAGES FOR TELEGRAM BOT USERS AND OTHER VARIABLES
# =================================================================================================
BTN_LIST = {
'message_text': 'На какую бутылку сядешь?',
'buttons':
{
'пива': 'Пиво',
'вина': 'Вино',
},
}