getPlugin(PingPlugin::class); * * $plugin->setPongText('UwU'); * ``` * * This will automatically connect to the running instance of the plugin and call the specified method. */ public function setPongText(string $pong): void { $this->pongText = $pong; } /** * Returns a list of names for properties that will be automatically saved to the session database (MySQL/postgres/redis if configured, the session file otherwise). */ public function __sleep(): array { return ['pingCount', 'pongText']; } /** * Initialization logic. */ public function onStart(): void { $this->logger("The bot was started!"); $this->logger($this->getFullInfo('MadelineProto')); $this->sendMessageToAdmins("The bot was started!"); } /** * Plugins may be enabled or disabled at startup by returning true or false from this function. */ public function isPluginEnabled(): bool { return true; } /** * This cron function will be executed forever, every 60 seconds. */ #[Cron(period: 60.0)] public function cron1(): void { $this->sendMessageToAdmins("The ping plugin is online, total pings so far: ".$this->pingCount); } #[FilterText('ping')] public function pingCommand(Incoming&Message $message): void { $message->reply($this->pongText); $this->pingCount++; } }