Skip to content

Quick start

Protocol Corporation edited this page Apr 2, 2024 · 1 revision
  1. First, you need to create an auxiliary object: TblData:
$BotData = newTblData(
$Token,
$DirLogs,
$TokenWebhook,
$LogLevel,
$TestServer,
$LogHandler
);
  1. Finally, you create the bot object:
$Bot = newTelegramBotLibrary($BotData);
  1. To register the webhook, use the TgWebhook object:
$Webhook = newTblWebhook($BotData);
$Webhook->Set(
Url: $Url,
Updates: $Updates,
TokenWebhook: $TokenWebhook
);
  1. When an update occurs, the URL are called. In the file, get the data:
$Webhook = $Bot->WebhookGet();
  1. Now, detect the update type and do your thing:
if($Webhook::class === TgText::class):
//do somethingendif;

Clone this wiki locally