Skip to content
Protocol Corporation edited this page Nov 26, 2024 · 10 revisions

Requirements

  1. The namespace must beProtocolLive\StbModules for single bot;
  2. Must implements the interface ProtocolLive\SimpleTelegramBot\StbInterfaces\StbModuleInterface
  3. Must call function DebugTrace() in first line of every method;
  4. The file structure must be: modules/MODULE_NAME/index.php
  5. Global module must have an install and uninstall script in Composer bin folder; (Example with TalkAs module);

Notes

  • There is a parent class called ProtocolLive\SimpleTelegramBot\StbObjects\StbModuleHelper with helpers;

Methods

Command

publicstaticfunction Command(
TelegramBotLibrary$Bot,
TblCmd$Webhook,
StbDatabase$Db,
StbLanguageSys$Lang
):void;

That method are called when the user use a command.

Cron

publicstaticfunction Cron(
TelegramBotLibrary$Bot,
StbDatabase$Db,
TblData$BotData
):void;

Method used with cron jobs

Install

publicstaticfunction Install(
TelegramBotLibrary$Bot,
TgCallback$Webhook,
StbDatabase$Db,
StbLanguageSys$Lang
):void;

That method are called by admin menu to install the module.

Tips

  • Run parent::InstallCmd before parent::InstallHelper;

Listeners

publicstaticfunction Listener(
TelegramBotLibrary$Bot,
TgEventInterface$Webhook,
StbDatabase$Db,
StbLanguageSys$Lang
):void;

That method are called when a event registered in datababase occurs.

Uninstall

publicstaticfunction Uninstall(
TelegramBotLibrary$Bot,
TgCallback$Webhook,
StbDatabase$Db,
StbLanguageSys$Lang
):void;

That method are called by admin menu to uninstall the module.

Plugin

See session Plugin - Buttons

Clone this wiki locally