From 7435e9f9cc27f17ddc11b165b840b1a1316e21e2 Mon Sep 17 00:00:00 2001 From: tokumeikoi Date: Thu, 27 Jan 2022 15:20:03 +0800 Subject: [PATCH] update: telegram commands --- app/Plugins/Telegram/Commands/Help.php | 22 ------------------- app/Plugins/Telegram/Commands/ReplyTicket.php | 2 +- app/Plugins/Telegram/Commands/Traffic.php | 2 -- app/Plugins/Telegram/Commands/UnBind.php | 2 -- 4 files changed, 1 insertion(+), 27 deletions(-) delete mode 100644 app/Plugins/Telegram/Commands/Help.php diff --git a/app/Plugins/Telegram/Commands/Help.php b/app/Plugins/Telegram/Commands/Help.php deleted file mode 100644 index 2c677b20..00000000 --- a/app/Plugins/Telegram/Commands/Help.php +++ /dev/null @@ -1,22 +0,0 @@ -is_private) return; - $commands = [ - '/bind 订阅地址 - 绑定你的' . config('v2board.app_name', 'V2Board') . '账号', - '/traffic - 查询流量信息', - '/getlatesturl - 获取最新的' . config('v2board.app_name', 'V2Board') . '网址', - '/unbind - 解除绑定' - ]; - $text = implode(PHP_EOL, $commands); - $this->telegramService->sendMessage($message->chat_id, "你可以使用以下命令进行操作:\n\n$text", 'markdown'); - } -} diff --git a/app/Plugins/Telegram/Commands/ReplyTicket.php b/app/Plugins/Telegram/Commands/ReplyTicket.php index 7ccc02b6..e4a64d04 100644 --- a/app/Plugins/Telegram/Commands/ReplyTicket.php +++ b/app/Plugins/Telegram/Commands/ReplyTicket.php @@ -22,9 +22,9 @@ class ReplyTicket extends Telegram { if (!$user) { abort(500, '用户不存在'); } - $ticketService = new TicketService(); if (!$msg->text) return; if (!($user->is_admin || $user->is_staff)) return; + $ticketService = new TicketService(); $ticketService->replyByAdmin( $ticketId, $msg->text, diff --git a/app/Plugins/Telegram/Commands/Traffic.php b/app/Plugins/Telegram/Commands/Traffic.php index 38e5c258..d1412a07 100644 --- a/app/Plugins/Telegram/Commands/Traffic.php +++ b/app/Plugins/Telegram/Commands/Traffic.php @@ -15,8 +15,6 @@ class Traffic extends Telegram { if (!$message->is_private) return; $user = User::where('telegram_id', $message->chat_id)->first(); if (!$user) { - $help = new Help(); - $help->handle($message); $telegramService->sendMessage($message->chat_id, '没有查询到您的用户信息,请先绑定账号', 'markdown'); return; } diff --git a/app/Plugins/Telegram/Commands/UnBind.php b/app/Plugins/Telegram/Commands/UnBind.php index ad1d4a91..6dde5cf7 100644 --- a/app/Plugins/Telegram/Commands/UnBind.php +++ b/app/Plugins/Telegram/Commands/UnBind.php @@ -14,8 +14,6 @@ class UnBind extends Telegram { $user = User::where('telegram_id', $message->chat_id)->first(); $telegramService = $this->telegramService; if (!$user) { - $help = new Help(); - $help->handle($message); $telegramService->sendMessage($message->chat_id, '没有查询到您的用户信息,请先绑定账号', 'markdown'); return; }