From ea67d826e2126af9dac46adbf16efaffb1aaacaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D9=8EAhJ?= Date: Thu, 2 Nov 2023 14:27:57 +0330 Subject: [PATCH] Restore restart plugin --- src/EventHandler/Plugin/RestartPlugin.php | 33 +++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/EventHandler/Plugin/RestartPlugin.php 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