<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
californiamountainsnake / longmantelegrambot-inlinemenu example snippets
// Create your own Telegram class:
class MyTelegram extends InlineMenuTelegram
{
}
// somewhere in the webhook.php:
$telegram = new MyTelegram($bot_api_key, $bot_username);
$menu = new Menu('Top root menu', 'root', [
[
InlineButton::startCommand('Help!', 'help'),
InlineButton::url('It\'s google', 'https://google.ru'),
],
[
InlineButton::toast('toast_identifier', 'Toast text!'),
new Menu('Sub menu', 'submenu', [
InlineButton::toast('sub_menu_toast', 'Submenu toast!'),
InlineButton::menuSection('<< Back', Menu::path('root'))
]),
]
]);
// You must call this method once only on the your TOP level menu object.
$menu->buildPathsFromThisRoot();
class CallbackqueryCommand extends InlineMenuCallbackqueryCommand
{
protected function getRootMenu(): Menu
{
// return the Menu object from the previous step
return new Menu (...);
}
}
$menu = new Menu (...);
$menu->buildPathsFromThisRoot();
$inlineKeyboard = $menu->getInlineKeyboard();
Request::sendMessage([
'chat_id' => 'some_chat_id',
'text' => 'This is menu!',
'reply_markup' => $inlineKeyboard,
]);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.