Exemple #1
0
import logging
from pyAitu import Bot, Dispatcher, executor
from pyAitu.models import Message, QuickButtonSelected, InlineCommandSelected, ContentType, \
    QuickButtonCommand, InlineCommand, ReplyCommand, Media, Contact, MessageIdAssigned
import pyAitu.models.constants.file_type as file_type

API_TOKEN = 'YOUR_API_TOKEN'

logging.basicConfig(level=logging.INFO)

bot = Bot(token=API_TOKEN)
dp = Dispatcher(bot)

WELCOME_MENUS = [
    QuickButtonCommand("inline", 'welcome-menu-inline'),
    QuickButtonCommand("reply", 'welcome-menu-reply'),
    QuickButtonCommand("quick", 'welcome-menu-quick'),
]

INLINE_COMMAND_MENU = [
    InlineCommand("1", "inline-command-data-ASD-1"),
    InlineCommand("2", "inline-command-data-ASD-2"),
    InlineCommand("3", "inline-command-data-ASD-3"),
]

REPLY_COMMAND_MENU = [
    ReplyCommand("1"),
    ReplyCommand("2"),
    ReplyCommand("3"),
]
Exemple #2
0
import logging
from pyAitu import executor, Bot, Dispatcher
from pyAitu.models import Message, Options, Form, Header, FormClosed, BottomBar, FormAction, FormSubmitted

API_TOKEN = 'YOUR_API_TOKEN'

bot = Bot(token=API_TOKEN)
dispatcher = Dispatcher(bot)

logging.basicConfig(level=logging.INFO)


def make_form() -> Form:
    form_id = "bottom_bar_form_id"
    header = Header(_type="title",
                    title="Bottom bar component",
                    options=Options(closeable=True))
    bottom_bar = BottomBar(content_id="bottom_bar_id",
                           title="Bottom Bar",
                           form_action=FormAction(
                               action="submit_form",
                               data_template="Message from bottom bar"))
    return Form(_id=form_id, header=header, content=[], bottom_bar=bottom_bar)


@dispatcher.message_handler()
async def handle(message: Message):
    form = make_form()
    await bot.send_form(message.chat.id, form=form)