diff --git a/src/EventHandler/Plugin/RestartPlugin.php b/src/EventHandler/Plugin/RestartPlugin.php new file mode 100644 index 000000000..81aaf86a0 --- /dev/null +++ b/src/EventHandler/Plugin/RestartPlugin.php @@ -0,0 +1,33 @@ +. + * + * @author Daniil Gentili + * @copyright 2016-2023 Daniil Gentili + * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 + * @link https://docs.madelineproto.xyz MadelineProto documentation + */ + +namespace danog\MadelineProto\EventHandler\Plugin; + +use danog\MadelineProto\EventHandler\Filter\FilterCommand; +use danog\MadelineProto\EventHandler\Message; +use danog\MadelineProto\EventHandler\SimpleFilter\FromAdmin; +use danog\MadelineProto\EventHandler\SimpleFilter\Incoming; +use danog\MadelineProto\PluginEventHandler; + +/** + * Plugin that offers a /restart command to admins that can be used to restart the bot, applying changes. + */ +final class RestartPlugin extends PluginEventHandler { + #[FilterCommand('restart')] + public function cmd(Incoming&Message&FromAdmin $_): void + { + $this->restart(); + } +} \ No newline at end of file