mirror of
https://github.com/v2board/v2board.git
synced 2024-11-10 09:39:10 +08:00
update: telegram commands
This commit is contained in:
parent
78a87125c8
commit
7435e9f9cc
@ -1,22 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Plugins\Telegram\Commands;
|
||||
|
||||
use App\Plugins\Telegram\Telegram;
|
||||
|
||||
class Help extends Telegram {
|
||||
public $command = '/help';
|
||||
public $description = '获取帮助';
|
||||
|
||||
public function handle($message, $match = []) {
|
||||
if (!$message->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');
|
||||
}
|
||||
}
|
@ -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,
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user