Exemplo n.º 1
0
def test_keyboard_non_builder():
    keyboard = Keyboard(one_time=True)
    keyboard.add(Text("I love nuggets", {"love": "nuggets"}))
    keyboard.row()
    keyboard.add(Callback("Eat nuggets", {"eat": "nuggets"}),
                 color=KeyboardButtonColor.POSITIVE)
    assert keyboard.get_json() == KEYBOARD_JSON
Exemplo n.º 2
0
async def ban(message, text='не указана'):
    await data.lvl.user(id := message.reply_message.from_id)
    await message.answer(f"Бан пользователя:\n{data.lvl[id]}\nПричина: {text}",
                         keyboard=Keyboard(inline=True).add(
                             Text(label='Ясно-понятно',
                                  payload={'command': 'ban'}),
                             color=KeyboardButtonColor.POSITIVE).get_json())