From df739b6d541544f52a057333bbd250e7c26f0d8d Mon Sep 17 00:00:00 2001 From: Dnomd343 Date: Mon, 9 Aug 2021 17:38:22 +0800 Subject: [PATCH] update: help message of /dc command --- models/tgDC.php | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/models/tgDC.php b/models/tgDC.php index 7654eb8..aff4125 100644 --- a/models/tgDC.php +++ b/models/tgDC.php @@ -159,11 +159,25 @@ class tgDC { } function tgDC($rawParam) { // DC查询入口 - global $chatId, $userAccount; - if ($rawParam === '') { - $rawParam = $userAccount; + global $chatId, $userAccount, $isGroup; + if ($rawParam !== '') { // 请求不为空 + sendMessage($chatId, (new tgDC)->getInfo($rawParam)); // 查询并返回数据 + return; } - sendMessage($chatId, (new tgDC)->getInfo($rawParam)); + if (!$isGroup) { // 群组不发送帮助信息 + $message = json_decode(sendMessage($chatId, array( // 发送帮助信息 + 'parse_mode' => 'Markdown', + 'text' => '*Usage:* `/dc username`' + )), true); + } + sendMessage($chatId, (new tgDC)->getInfo($userAccount)); // 查询并返回数据 + if ($isGroup) { return; } + sleep(20); + sendPayload(array( // 删除帮助信息 + 'method' => 'deleteMessage', + 'chat_id' => $chatId, + 'message_id' => $message['result']['message_id'] + )); } ?> \ No newline at end of file