Esempio n. 1
0
async def faq(message: types.Message):
    questions = database.get('faq')
    faq_keyboard = InlineKeyboardMarkup(inline_keyboard=[[
        InlineKeyboardButton(questions[i]['question'],
                             callback_data='faq:' + str(i))
    ] for i in range(len(questions))])
    await message.answer('FAQ', reply_markup=faq_keyboard)
Esempio n. 2
0
async def callback_choice_faq(call: CallbackQuery):
    questions = database.get('faq')
    index = int(call.data.split(':')[1])
    await call.message.answer(questions[index]['answer'])
Esempio n. 3
0
 async def get(message: types.Message):
     database.registration_user(message)
     await standard_answer(message, database.get(name), markup)
Esempio n. 4
0
 async def admin_get(message: types.Message):
     await standard_answer(message, database.get(name))
     await message.answer(f'Опции секции "{name}"',
                          reply_markup=options_keyboard)
Esempio n. 5
0
from aiogram import types
from aiogram.types import KeyboardButton, ReplyKeyboardMarkup,  InlineKeyboardMarkup, \
    ReplyKeyboardRemove, ForceReply, InlineKeyboardButton, CallbackQuery

from pprint import pprint

from controllers.bot import bot_dp
from States import States
from DataBase.main import database
from controllers.Admin.admin_markup import admin_markup

questions = database.get('faq')


async def send_faq(message: types.Message):
    for question in questions:
        index = questions.index(question)
        options_keyboard = InlineKeyboardMarkup(
            inline_keyboard=[
                [
                    # InlineKeyboardButton('Изменить', callback_data=f'faq:edit:{index}'),
                    InlineKeyboardButton('Удалить', callback_data=f'faq:del:{index}')
                ]
            ]
        )

        await message.answer(
            f'Вопрос:\n{question["question"]}\n\nОтвет:\n{question["answer"]}',
            reply_markup=options_keyboard
        )