コード例 #1
0
async def inline_answer_callback_handler(query: types.CallbackQuery):
    TelegramAPI.process_categories(self=bot_api, query=query)
    response, keyboard_markup = TelegramAPI.categories_command(self=bot_api,
                                                               query=query)
    await bot.send_message(query.from_user.id,
                           response,
                           reply_markup=keyboard_markup)
コード例 #2
0
async def inline_answer_callback_handler(query: types.CallbackQuery):
    response = TelegramAPI.chose_command(self=bot_api, data=query)
    await bot.send_message(query.from_user.id, response)
コード例 #3
0
async def command_cmd_handler(message: types.Message):
    response = TelegramAPI.unsubscribe_command(self=bot_api, data=message)
    await message.reply(response)
コード例 #4
0
async def inline_answer_callback_handler(query: types.CallbackQuery):
    response, keyboard_markup = TelegramAPI.find_command(self=bot_api,
                                                         data=query)
    await bot.send_message(query.from_user.id,
                           response,
                           reply_markup=keyboard_markup)
コード例 #5
0
async def inline_answer_callback_handler(query: types.CallbackQuery):
    response = TelegramAPI.process_city(self=bot_api, query=query)
    await bot.send_message(query.from_user.id, response)
コード例 #6
0
async def command_cmd_handler(message: types.Message):
    response = TelegramAPI.help_command()
    await message.reply(response)
コード例 #7
0
async def command_cmd_handler(message: types.Message):
    response, keyboard_markup = TelegramAPI.registration_command(data=message)
    await message.reply(response, reply_markup=keyboard_markup)
コード例 #8
0
async def command_cmd_handler(message: types.Message):
    response = TelegramAPI.start_command(self=bot_api, message=message)
    await message.reply(response)
コード例 #9
0
async def command_cmd_handler(message: types.Message):
    response, keyboard_markup = TelegramAPI.categories_command(self=bot_api,
                                                               query=message)
    await message.reply(response, reply_markup=keyboard_markup)
コード例 #10
0
import logging
from aiogram import Bot, Dispatcher, executor, types
from config import TG_TOKEN, DB_CONFIG
from bot_api import TelegramAPI, BotAPI

logging.basicConfig(level=logging.INFO)

bot = Bot(token=TG_TOKEN)
dp = Dispatcher(bot)
database_config = DB_CONFIG
bot_api = TelegramAPI(database_config)


@dp.message_handler(commands='categories')
async def command_cmd_handler(message: types.Message):
    response, keyboard_markup = TelegramAPI.categories_command(self=bot_api,
                                                               query=message)
    await message.reply(response, reply_markup=keyboard_markup)


@dp.message_handler(commands='start')
async def command_cmd_handler(message: types.Message):
    response = TelegramAPI.start_command(self=bot_api, message=message)
    await message.reply(response)


@dp.message_handler(commands='registration')
async def command_cmd_handler(message: types.Message):
    response, keyboard_markup = TelegramAPI.registration_command(data=message)
    await message.reply(response, reply_markup=keyboard_markup)