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
handlers/__init__.py Normal file
View File

@@ -0,0 +1 @@
from handlers import callback_handlers, message_handlers

View File

@@ -0,0 +1,14 @@
from aiogram import types, Dispatcher
from bot_lib.settings import BTN_LIST
from bot_lib.bot_create import logger, some_cb
async def callback_btn_actions(callback_query: types.CallbackQuery, callback_data: dict):
logger.info(f'Callback data: {callback_data}')
await callback_query.message.answer(f'Ну что ж, это был твой выбор... Теперь садись на бутылку {callback_data["action"]}... <i>Пидор</i>')
def register_callback_handlers(dp: Dispatcher):
# Place your handlers here
actions = BTN_LIST['buttons'].keys() | BTN_LIST['buttons'].keys()
dp.register_callback_query_handler(callback_btn_actions, some_cb.filter(action=actions))

View File

@@ -0,0 +1,28 @@
from aiogram import types, Dispatcher
from bot_lib.bot_create import logger, some_cb
from bot_lib.settings import BTN_LIST
from keyboards.common_keyboards import get_text_and_buttons_inline
# @dp.message_handler(commands=['start'])
async def cmd_start(message: types.Message):
logger.info(f"{message.from_user.username} (id: {message.from_user.id}) wrote: {message.text}")
# send menu
text, buttons = await get_text_and_buttons_inline(BTN_LIST, some_cb)
await message.answer(text, reply_markup=buttons)
# @dp.message_handler(content_types=[types.ContentType.NEW_CHAT_MEMBERS, types.ContentType.LEFT_CHAT_MEMBER])
async def user_joined_chat(message: types.Message):
logger.info(f"{message.from_user.username} (id: {message.from_user.id}) joined chat")
text, buttons = await get_text_and_buttons_inline(BTN_LIST, some_cb)
await message.answer(text, reply_markup=buttons)
def register_message_handlers(dp: Dispatcher):
# Place your handlers here
dp.register_message_handler(cmd_start, commands=['start'])
dp.register_message_handler(user_joined_chat, content_types=[types.ContentType.NEW_CHAT_MEMBERS])