def make_inline_keyboard_notifications():
    """Кнопка 'Настройка уведомлений'"""
    keyboard = Keyboard(one_time=False)
    keyboard.row()
    keyboard.add(Text(label='Настройки ⚙'), color=KeyboardButtonColor.PRIMARY)
    keyboard.row()
    keyboard.add(Text(label='<==Назад'), color=KeyboardButtonColor.SECONDARY)
    return keyboard
def make_keyboard_nearlesson():
    """Создаём основные кнопки"""
    keyboard = Keyboard(one_time=False)
    keyboard.row()
    keyboard.add(Text(label="Текущая"), color=KeyboardButtonColor.PRIMARY)
    keyboard.add(Text(label="Следующая"), color=KeyboardButtonColor.PRIMARY)
    keyboard.row()
    keyboard.add(Text(label="<==Назад"), color=KeyboardButtonColor.SECONDARY)
    return keyboard
Ejemplo n.º 3
0
async def start_handler(message: Message):
    await message.answer(
        "Hi! Welcome to the start menu, use menu buttons",
        keyboard=(Keyboard().add(Text("Info", {"cmd": "info"})).add(
            Text("Buy coffee", {"cmd": "buy"})).get_json()),
    )
    # If you handle chats you can set state dispenser key to from_id
    # or you can implement custom state dispenser and base on other features
    await bot.state_dispenser.set(message.peer_id, MenuState.START)
Ejemplo n.º 4
0
async def info_handler(message: Message):
    await message.answer(
        "What are you interested in?",
        keyboard=(Keyboard().add(Text("Books", {"item": "books"})).add(
            Text("Cinema",
                 {"item": "cinema"})).add(Text("Undo",
                                               {"item": "undo"})).get_json()),
    )
    await bot.state_dispenser.set(message.peer_id, MenuState.INFO)
def make_keyboard_extra():
    keyboard = Keyboard(one_time=False)
    keyboard.row()
    keyboard.add(Text(label="Список команд"),
                 color=KeyboardButtonColor.PRIMARY)
    keyboard.row()
    keyboard.add(Text(label="Поиск 🔎"), color=KeyboardButtonColor.SECONDARY)
    keyboard.row()
    keyboard.add(Text(label="<==Назад"), color=KeyboardButtonColor.SECONDARY)
    return keyboard
def make_keyboard_choose_schedule():
    '''Создаёт клавиатуру для выбора недели'''
    keyboard = Keyboard(one_time=False)
    keyboard.row()
    keyboard.add(Text(label="На текущую неделю"),
                 color=KeyboardButtonColor.PRIMARY)
    keyboard.add(Text(label="На следующую неделю"),
                 color=KeyboardButtonColor.PRIMARY)
    keyboard.row()
    keyboard.add(Text(label="Основное меню"),
                 color=KeyboardButtonColor.SECONDARY)
    return keyboard
def make_keyboard_commands():
    """Создаём кнопки команд"""
    keyboard = Keyboard(one_time=False)
    keyboard.row()
    # keyboard.add(Text(label="about"), color=KeyboardButtonColor.PRIMARY)
    keyboard.add(Text(label="Авторы"), color=KeyboardButtonColor.PRIMARY)
    keyboard.row()
    keyboard.add(Text(label="Регистрация"),
                 color=KeyboardButtonColor.SECONDARY)
    keyboard.add(Text(label="Карта"), color=KeyboardButtonColor.SECONDARY)
    keyboard.row()
    keyboard.add(Text(label="<==Назад"), color=KeyboardButtonColor.SECONDARY)
    return keyboard
Ejemplo n.º 8
0
async def summary_handler(message: Message):
    event: EventCreate = message.state_peer.payload.get("obj")
    event.summary = message.text
    await message.answer(
        message="Выберите количество человек: 1-10, 10-30, >30",
        keyboard=(Keyboard(one_time=False, inline=False).add(
            Text("1-10",
                 payload={"count":
                          5})).add(Text("10-30", payload={"count": 25})).add(
                              Text(">30", payload={"count": 50}))).get_json())
    await bot.state_dispenser.set(message.peer_id,
                                  CreateStates.COUNT_STATE,
                                  obj=event)
Ejemplo n.º 9
0
 def _generate_keyboard(self, peer_id, chat_flg=False) -> str:
     admin_flg = peer_id in self._admins
     keyboard = Keyboard(one_time=not admin_flg and chat_flg)
     if not self._timetable_work_flg and admin_flg:
         keyboard.row()
         keyboard.add(Text("Включить уведомления."),
                      color=KeyboardButtonColor.POSITIVE)
     keyboard.row()
     keyboard.add(Text("Расписание на сегодня."),
                  color=KeyboardButtonColor.POSITIVE)
     keyboard.row()
     keyboard.add(Text("Да или нет?"), color=KeyboardButtonColor.PRIMARY)
     keyboard.row()
     keyboard.add(Text("Поддержать."))
     return keyboard.get_json()
def make_inline_keyboard_set_notifications(time=0):
    """кнопки настройки уведомлений"""
    if time != 0:
        text_check = f'{time} мин'
    else:
        text_check = 'off'

    keyboard = Keyboard(one_time=False)

    keyboard.row()
    keyboard.add(Text(label="-"), color=KeyboardButtonColor.PRIMARY)
    keyboard.add(Text(label=text_check), color=KeyboardButtonColor.PRIMARY)
    keyboard.add(Text(label='+'), color=KeyboardButtonColor.PRIMARY)
    keyboard.row()
    keyboard.add(Text(label="Сохранить"), color=KeyboardButtonColor.SECONDARY)

    return keyboard
Ejemplo n.º 11
0
async def game(message: Message):
    reg(message)
    data = json.load(open('data.json', 'r'))
    bal = str(int(data['balance'][str(message.from_id)]) / 2)
    keyboard = (Keyboard().add(
        Text('100'), color=KeyboardButtonColor.PRIMARY).add(
            Text('1000'), color=KeyboardButtonColor.PRIMARY).add(
                Text('10000'), color=KeyboardButtonColor.PRIMARY).row().add(
                    Text(bal[0:bal.find('.')]),
                    color=KeyboardButtonColor.PRIMARY).add(
                        Text(data['balance'][str(message.from_id)]),
                        color=KeyboardButtonColor.PRIMARY).add(
                            Text('Назад'),
                            color=KeyboardButtonColor.NEGATIVE).get_json())
    data['gameInfo'][message.from_id] = '1'
    json.dump(data, open('data.json', 'w'))
    await message.answer('😎 Введите сумму ставки:', keyboard=keyboard)
def make_keyboard_start_menu():
    """Создаём основные кнопки"""
    keyboard = Keyboard(one_time=False)
    keyboard.row()
    keyboard.add(Text(label="Расписание 🗓"), color=KeyboardButtonColor.PRIMARY)
    keyboard.add(Text(label="Ближайшая пара ⏱"),
                 color=KeyboardButtonColor.PRIMARY)
    keyboard.row()
    keyboard.add(Text(label="Расписание на сегодня 🍏"),
                 color=KeyboardButtonColor.SECONDARY)
    keyboard.row()
    keyboard.add(Text(label="Расписание на завтра 🍎"),
                 color=KeyboardButtonColor.SECONDARY)
    keyboard.row()
    keyboard.add(Text(label="Напоминание 📣"),
                 color=KeyboardButtonColor.PRIMARY)
    keyboard.add(Text(label="Другое ⚡"), color=KeyboardButtonColor.PRIMARY)
    return keyboard
Ejemplo n.º 13
0
from vkbottle import Keyboard, Text, KeyboardButtonColor

# Simplest way of generating keyboard is non-builder interface
# Use <.raw()> to add raw
# Use <.add(Action(...), COLOR)> to add button to the last raw
# Use <.get_json()> to make keyboard sendable
KEYBOARD_STANDARD = Keyboard(one_time=True, inline=False)
KEYBOARD_STANDARD.add(Text("Button 1"), color=KeyboardButtonColor.POSITIVE)
KEYBOARD_STANDARD.add(Text("Button 2"))
KEYBOARD_STANDARD.row()
KEYBOARD_STANDARD.add(Text("Button 3"))
KEYBOARD_STANDARD = KEYBOARD_STANDARD.get_json()

# add and row methods returns the instance of Keyboard
# so you can use it as builder
KEYBOARD_WITH_BUILDER = (
    Keyboard(one_time=True, inline=False)
    .add(Text("Button 1"), color=KeyboardButtonColor.POSITIVE)
    .add(Text("Button 2"))
    .row()
    .add(Text("Button 3"))
    .get_json()
)

# Schema is another way to create keyboard
# all fields except of color are read as action fields
KEYBOARD_WITH_SCHEMA = (
    Keyboard(one_time=True, inline=False)
    .schema(
        [
            [
Ejemplo n.º 14
0
from vkbottle.bot import Bot, Message
from vkbottle import template_gen, TemplateElement, Keyboard, Text
import os

bot = Bot(os.environ["TOKEN"])

# You can use keyboard generators to fill the buttons field
keyboard_1 = Keyboard().add(Text("button 1", {})).get_json()
keyboard_2 = Keyboard().add(Text("button 2", {})).get_json()

# More about combining fields can be read in vk documentation
# for templates: https://vk.com/dev/bot_docs_templates
template = template_gen(
    TemplateElement(photo_id="-109837093_457242809",
                    buttons=keyboard_1,
                    action={"type": "open_photo"}),
    TemplateElement(photo_id="-109837093_457242809",
                    buttons=keyboard_2,
                    action={"type": "open_photo"}),
)


@bot.on.message(text="хочу темплейт")
async def template_handler(message: Message):
    await message.answer("держи", template=template)


bot.run_forever()
Ejemplo n.º 15
0
async def game2(message: Message, mess: Optional[str] = None):
    reg(message)
    data = json.load(open('data.json', 'r'))
    if str(message.from_id) in data['gameInfo']:
        if data['gameInfo'][str(message.from_id)] == '1':
            if mess.isdigit():
                if int(mess) == 0:
                    await message.answer(
                        '😁 Ого, когда слыхано, что 0 можно прибавить к балансу? Прошу напишите число больше 0!'
                    )
                else:
                    if not int(mess) > int(data['balance'][str(
                            message.from_id)]):
                        keyboard = (Keyboard().add(
                            Text('Орел'),
                            color=KeyboardButtonColor.PRIMARY).add(
                                Text('Решка'),
                                color=KeyboardButtonColor.PRIMARY).row().add(
                                    Text('Назад'),
                                    color=KeyboardButtonColor.NEGATIVE).
                                    get_json())
                        data = json.load(open('data.json', 'r'))
                        data['stavka'][message.from_id] = str(mess)
                        data['gameInfo'][message.from_id] = '2'
                        await message.answer(
                            '🙂 Орел или решка? Вот в чем вопрос...',
                            keyboard=keyboard)
                        json.dump(data, open('data.json', 'w'))
                    else:
                        data = json.load(open('data.json', 'r'))
                        await message.answer(
                            '🙄 Ваш баланс ' +
                            str(data['balance'][str(message.from_id)]) +
                            ', но его можно пополнить',
                            keyboard=main)
                        data['gameInfo'][message.from_id] = '0'
                        data['stavka'][message.from_id] = '0'
                        json.dump(data, open('data.json', 'w'))

            else:
                await message.answer('😅 Это не число, введите пожалуйста число'
                                     )

        else:
            data = json.load(open('data.json', 'r'))
            if data['gameInfo'][str(message.from_id)] == '2':
                if mess in ['Орел', 'Решка']:
                    itog = random.randint(1, 3)
                    if itog == 1:
                        data['balance'][str(message.from_id)] = str(
                            int(data['balance'][str(message.from_id)]) +
                            int(data['stavka'][str(message.from_id)]))
                        data['gameInfo'][str(message.from_id)] = '0'
                        if message.text == 'Орел':
                            await message.answer(
                                f'💰 Ура это победа! Выпадает Орел\n\n💎 Вы выиграли {data["stavka"][str(message.from_id)]} SoccerCoin!',
                                keyboard=main)
                            data['stavka'][str(message.from_id)] = '0'
                            json.dump(data, open('data.json', 'w'))
                        else:
                            await message.answer(
                                f'💰 Ура это победа! Выпадает Решка\n\n💎 Вы выиграли {data["stavka"][str(message.from_id)]} SoccerCoin!',
                                keyboard=main)
                            data['stavka'][str(message.from_id)] = '0'
                            json.dump(data, open('data.json', 'w'))
                    else:
                        data['balance'][str(message.from_id)] = str(
                            int(data['balance'][str(message.from_id)]) -
                            int(data['stavka'][str(message.from_id)]))
                        data['gameInfo'][str(message.from_id)] = '0'
                        if message.text == 'Орел':
                            await message.answer(
                                f'💥 Выпадает Решка\n\n😕 Вы проиграли {data["stavka"][str(message.from_id)]} SoccerCoin!',
                                keyboard=main)
                            data['stavka'][str(message.from_id)] = '0'
                            json.dump(data, open('data.json', 'w'))
                        else:
                            await message.answer(
                                f'💥 Выпадает Орел\n\n😕 Вы проиграли {data["stavka"][str(message.from_id)]} SoccerCoin!',
                                keyboard=main)
                            data['stavka'][str(message.from_id)] = '0'
                            json.dump(data, open('data.json', 'w'))
                else:
                    await message.answer(
                        '😡 Орел или решка!! Лучше тебя в главное меню направлю, вдруг что...',
                        keyboard=main)
                    data = json.load(open('data.json', 'r'))
                    data['gameInfo'][str(message.from_id)] = '0'
                    data['stavka'][str(message.from_id)] = '0'
                    json.dump(data, open('data.json', 'w'))
    else:
        if message.text.find('.') != -1:
            await message.answer(
                '😅 Нужно водить лишь полные числа, без точки и запятой')
        elif message.text.find(',') != -1:
            await message.answer(
                '😅 Нужно водить лишь полные числа, без точки и запятой')
Ejemplo n.º 16
0
            if str(message.ref) in refs:
                if str(message.from_id) not in refs[str(message.ref)]:
                    data['balance'][str(message.from_id)] = str(10000)
                    data['balance'][str(message.ref)] = str(
                        int(data['balance'][str(message.ref)]) + int(refMoney))
                    refs[str(message.ref)].append(str(message.from_id))
        except Exception as e:
            logs = json.load(open('log.json', 'r'))
            logs[str(len(logs) + 1)] = {'EXC': str(e)}
            json.dump(logs, open('log.json', 'w'))
        json.dump(data, open('data.json', 'w'))
        json.dump(refs, open('ref.json', 'w'))


main = (Keyboard().add(
    Text("Играть"), color=KeyboardButtonColor.POSITIVE).row().add(
        Text("Баланс"), color=KeyboardButtonColor.PRIMARY).row().add(
            OpenLink(link="https://vk.com/app7420483#m62_1000_2323232_0",
                     label='Пополнить'),
            color=KeyboardButtonColor.PRIMARY).add(
                Text("Вывод"), color=KeyboardButtonColor.PRIMARY).row().add(
                    Text('Реф'),
                    color=KeyboardButtonColor.POSITIVE).get_json())


@bot.on.message(text='Начать')
async def hello(message: Message):
    reg(message)
    await message.answer(
        """🐥 Привет, это игровой бот на валюту [https://vk.com/paper_scroll|PaperScroll]
Ejemplo n.º 17
0
import const

from typing import Optional

from vkbottle import Keyboard, Text, GroupTypes, GroupEventType, VKAPIError
from vkbottle.bot import Bot, Message

bot = Bot(const.token)

KEYBOARD = Keyboard(one_time=True).add(Text("Расписание",
                                            {"cmd": "schelude"})).get_json()


@bot.on.message(text=["Расписание", "расписание", "Начать"])
@bot.on.message(payload={"cmd": "schelude"})
async def command_schelude(message: Message, item: Optional[str] = None):
    await message.answer(f"Расписание:",
                         payload='rasp0001-1.jpg',
                         keyboard=KEYBOARD)


bot.run_forever()
Ejemplo n.º 18
0
import os
import random
import requests
from typing import Optional
import config
from config import db_server_api
from vkbottle import GroupEventType, GroupTypes, Keyboard, Text, VKAPIError
from vkbottle.bot import Bot, Message

token = "b2ac558da42dc23e631f34d3b5795ed6dbf8bd647001a703b8aa70f79bed894556abf4ee1b0fd7568626d"

bot = Bot(token=token)
HelP = False

# -----клавиатуры
keyboard_hello = Keyboard(one_time=True).add(Text(
    "Начать", {"cmd": "start"})).get_json()

keyboard_main = (Keyboard(one_time=False).add(Text(
    "Купить", {"cmd": "aio"})).add(Text("Помочь", {"cmd": "aio"})).row().add(
        Text("Профиль", {"cmd": "aio"})).add(Text("Перевести",
                                                  {"cmd": "aio"}))).get_json()

keyboard_buy = (Keyboard(one_time=False).add(
    Text("1 разработчик", {"cmd": "puy"})).row().add(
        Text("Команда из 3х", {"cmd": "puy"})).row().add(
            Text("Команда из 5ти", {"cmd": "puy"})).row().add(
                Text("Небольшая студия из 10", {"cmd": "puy"})).row().add(
                    Text("Крупная студия 30 человек",
                         {"cmd": "puy"})).row().add(
                             Text("Меню", {"cmd": "puy"}))).get_json()
Ejemplo n.º 19
0
from vkbottle import Text, Keyboard, KeyboardButtonColor

keyboard = Keyboard(one_time=False, inline=False)
keyboard.add(Text("Создать"), color=KeyboardButtonColor.POSITIVE)
keyboard.add(Text("Посмотреть все"))
async def reg_prep(bot: Bot, ans: Message, storage):
    """Регистрация преподавателя"""
    chat_id = ans.from_id
    message = ans.text
    page = 1

    if message == "Назад к институтам":
        await ans.answer('Назад к институтам',
                         keyboard=keyboards.make_keyboard_institutes(
                             storage.get_institutes()))
        storage.delete_vk_user_or_userdata(chat_id)
        await bot.state_dispenser.delete(ans.peer_id)
        return

    prep_list = storage.get_prep(message)

    if prep_list:
        prep_name = prep_list[0]['prep']
        storage.save_or_update_vk_user(chat_id=chat_id,
                                       group=prep_name,
                                       course='None')
        await bot.state_dispenser.delete(ans.peer_id)
        await ans.answer(
            f'Приветствую Вас, Пользователь! Вы успешно зарегистрировались, как {prep_name}!😊\n\n'
            "Я чат-бот для просмотра расписания занятий в Иркутском Политехе.🤖\n\n"
            "С помощью меня можно не только смотреть свое расписание на день или неделю, но и осуществлять поиск расписания по группам, аудиториям и преподавателям (кнопка [Поиск]).\n"
            "А еще можно настроить уведомления о парах (в разделе [Другое] кнопка [Напоминания]).\n\n"
            "Следующие советы помогут раскрыть мой функционал на 💯 процентов:\n"
            "⏭Используйте кнопки, так я буду Вас лучше понимать!\n\n"
            "🌄Подгружайте расписание утром и оно будет в нашем чате до скончания времен!\n\n"
            "📃Чтобы просмотреть список доступных команд и кнопок, напишите в чате [Помощь]\n\n"
            "🆘Чтобы вызвать эту подсказку снова, напиши в чат [Подсказка] \n\n"
            "Надеюсь, что Вам будет удобно меня использовать. Для того чтобы пройти регистрацию повторно, напишите сообщение [Регистрация]\n\n"
            "Если Вы столкнетесь с технической проблемой, то Вы можете:\n"
            "- обратиться за помощью в официальную группу ВКонтакте [https://vk.com/smartschedule]\n"
            "- написать одному из моих создателей (команда Авторы)🤭\n",
            keyboard=keyboards.make_keyboard_start_menu())
        return

    # Если преподавателя не нашли
    elif not prep_list and not prep_reg[chat_id]:
        # Делим введенное фио на части и ищем по каждой в базе
        prep_list = []
        prep_list_2 = []
        for name_unit in message.split():
            for i in storage.get_register_list_prep(name_unit):
                prep_list.append(i['prep'])
            if prep_list and prep_list_2:
                prep_list_2 = list(set(prep_list) & set(prep_list_2))
            elif prep_list and not prep_list_2:
                prep_list_2 = prep_list
            prep_list = []
        if not prep_list_2:
            prep_list_2 = None
        prep_list_reg = [page, prep_list_2]
        prep_reg[chat_id] = prep_list_reg
        if prep_reg[chat_id][1]:
            prep_list_2 = prep_reg[chat_id][1]
            keyboard = Keyboard(one_time=False)
            for i in prep_list_2[:8]:
                keyboard.row()
                keyboard.add(Text(label=i), color=KeyboardButtonColor.PRIMARY)
            keyboard.row()
            keyboard.add(Text(label='Назад к институтам'),
                         color=KeyboardButtonColor.PRIMARY)
            if len(prep_list_2) > 8:
                keyboard.add(Text(label='Далее'),
                             color=KeyboardButtonColor.PRIMARY)
            await ans.answer('Возможно Вы имели в виду', keyboard=keyboard)
            return
        else:
            storage.delete_vk_user_or_userdata(chat_id)
            await ans.answer(
                'Мы не смогли найти вас в базе преподавателей.\n'
                'Возможно вы неверно ввели своё ФИО.',
                keyboard=keyboards.make_keyboard_institutes(
                    storage.get_institutes()))
            await bot.state_dispenser.delete(ans.peer_id)

    if message == 'Далее':
        prep_reg[chat_id][0] += 1
        page = prep_reg[chat_id][0]
        prep_list_2 = prep_reg[chat_id][1]
        keyboard = Keyboard(one_time=False)
        if len(prep_list_2) - (page - 1) * 8 >= 8:
            for i in prep_list_2[(page - 1) * 8:(page - 1) * 8 + 8]:
                keyboard.row()
                keyboard.add(Text(label=i['prep']),
                             color=KeyboardButtonColor.PRIMARY)
            keyboard.row()
            keyboard.add(Text(label='Назад'),
                         color=KeyboardButtonColor.PRIMARY)
            keyboard.add(Text(label='Далее'),
                         color=KeyboardButtonColor.PRIMARY)
            keyboard.row()
            keyboard.add(Text(label='Назад к институтам'),
                         color=KeyboardButtonColor.PRIMARY)
        else:
            for i in prep_list_2[(page - 1) * 8:len(prep_list_2)]:
                keyboard.row()
                keyboard.add(Text(label=i), color=KeyboardButtonColor.PRIMARY)
            keyboard.row()
            keyboard.add(Text(label='Назад'),
                         color=KeyboardButtonColor.PRIMARY)
            keyboard.add(Text(label='Назад к институтам'),
                         color=KeyboardButtonColor.PRIMARY)
        await ans.answer(f'Страница {page}', keyboard=keyboard)

    elif message == 'Назад':
        prep_reg[chat_id][0] -= 1
        page = prep_reg[chat_id][0]
        prep_list_2 = prep_reg[chat_id][1]
        keyboard = Keyboard(one_time=False)
        for i in prep_list_2[(page - 1) * 8:page * 8]:
            keyboard.row()
            keyboard.add(Text(label=i), color=KeyboardButtonColor.PRIMARY)
        keyboard.row()
        if page != 1:
            keyboard.add(Text(label='Назад'),
                         color=KeyboardButtonColor.PRIMARY)
            keyboard.add(Text(label='Далее'),
                         color=KeyboardButtonColor.PRIMARY)
            keyboard.row()
            keyboard.add(Text(label='Назад к институтам'),
                         color=KeyboardButtonColor.PRIMARY)
        elif page == 1:
            keyboard.add(Text(label='Назад к институтам'),
                         color=KeyboardButtonColor.PRIMARY)
            keyboard.add(Text(label='Далее'),
                         color=KeyboardButtonColor.PRIMARY)
        await ans.answer(f'Страница {page}', keyboard=keyboard)

    return
Ejemplo n.º 21
0
from typing import Optional

from vkbottle import GroupEventType, GroupTypes, Keyboard, Text, VKAPIError
from vkbottle.bot import Bot, Message

bot = Bot(os.environ["token"])

# Logging level can be set through .basicConfig(level=LOGGING_LEVEL)
# but if you use loguru the instruction is different.
# ---
# If you use loguru you need to remove default logger and add new with
# level specified logging level, visit https://github.com/Delgan/loguru/issues/138
logging.basicConfig(level=logging.INFO)

# Documentation for keyboard builder > tools/keyboard
KEYBOARD = Keyboard(one_time=True).add(Text("Съесть еще",
                                            {"cmd": "eat"})).get_json()
EATABLE = ["мороженое", "макароны", "суп"]


# If you need to make handler respond for 2 different rule set you can
# use double decorator like here it is or use filters (OrFilter here)
@bot.on.message(text=["/съесть <item>", "/съесть"])
@bot.on.message(payload={"cmd": "eat"})
async def eat_handler(message: Message, item: Optional[str] = None):
    if item is None:
        item = random.choice(EATABLE)
    await message.answer(f"Ты съел <<{item}>>!", keyboard=KEYBOARD)


# You can use raw_event to handle any event type, the advantage is
# free dataclass, for example it can be dict if you have some problems
Ejemplo n.º 22
0
from vkbottle import Keyboard, KeyboardButtonColor, Text
from src.commands import *

KEYBOARD_ENTRYPOINT = Keyboard(inline=False, one_time=True)
KEYBOARD_ENTRYPOINT.add(Text(AdminOpenLock.button_name,
                             payload={'cmd': AdminOpenLock.key}),
                        color=KeyboardButtonColor.PRIMARY)

KEYBOARD_ENTRYPOINT.add(Text(AdminCloseLock.button_name,
                             payload={'cmd': AdminCloseLock.key}),
                        color=KeyboardButtonColor.PRIMARY)
KEYBOARD_ENTRYPOINT.row()
for command in [GetPasswordCommand, HelpCommand]:
    KEYBOARD_ENTRYPOINT.add(Text(command.button_name,
                                 payload={'cmd': command.key}),
                            color=KeyboardButtonColor.SECONDARY)