Init
This commit is contained in:
1
bot_lib/__init__.py
Normal file
1
bot_lib/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from bot_lib import bot_create, settings
|
||||
19
bot_lib/bot_create.py
Normal file
19
bot_lib/bot_create.py
Normal 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
17
bot_lib/settings.py
Normal 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':
|
||||
{
|
||||
'пива': 'Пиво',
|
||||
'вина': 'Вино',
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user