-
-
Notifications
You must be signed in to change notification settings - Fork 0
Modules
Protocol Corporation edited this page Nov 26, 2024
·
10 revisions
- The namespace must be
ProtocolLive\StbModules
for single bot; -
Must implements the interface
ProtocolLive\SimpleTelegramBot\StbInterfaces\StbModuleInterface
- Must call function DebugTrace() in first line of every method;
- The file structure must be:
modules/MODULE_NAME/index.php
- Global module must have an install and uninstall script in Composer
bin
folder; (Example with TalkAs module);
- There is a parent class called
ProtocolLive\SimpleTelegramBot\StbObjects\StbModuleHelper
with helpers;
public static function Command(
TelegramBotLibrary $Bot,
TblCmd $Webhook,
StbDatabase $Db,
StbLanguageSys $Lang
):void;
That method are called when the user use a command.
public static function Cron(
TelegramBotLibrary $Bot,
StbDatabase $Db,
TblData $BotData
):void;
Method used with cron jobs
public static function Install(
TelegramBotLibrary $Bot,
TgCallback $Webhook,
StbDatabase $Db,
StbLanguageSys $Lang
):void;
That method are called by admin menu to install the module.
- Run
parent::InstallCmd
beforeparent::InstallHelper
;
public static function Listener(
TelegramBotLibrary $Bot,
TgEventInterface $Webhook,
StbDatabase $Db,
StbLanguageSys $Lang
):void;
That method are called when a event registered in datababase occurs.
public static function Uninstall(
TelegramBotLibrary $Bot,
TgCallback $Webhook,
StbDatabase $Db,
StbLanguageSys $Lang
):void;
That method are called by admin menu to uninstall the module.
See session Plugin - Buttons