From da990d095fbc835d2d98fc047fbc24a2e728345b Mon Sep 17 00:00:00 2001 From: Dnomd343 Date: Tue, 10 Aug 2021 18:23:27 +0800 Subject: [PATCH] fix: force a space after command --- main.php | 5 +++-- models/cfopPic.php | 2 +- models/ipInfo.php | 2 +- models/tgDC.php | 4 ++-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/main.php b/main.php index af88ee4..5a5f17a 100644 --- a/main.php +++ b/main.php @@ -34,9 +34,10 @@ foreach ($cmds as $cmd) { if (strpos($messageText, '/' . $cmd) === 0) { // 判断请求开头 $rawParam = substr($messageText, strlen($cmd) + 1); // 获取请求参数 if ($isGroup && strpos($rawParam, '@' . $botAccount) === 0) { - $rawParam = substr($rawParam, strlen($botAccount) + 1); // 去除群组中@机器人 + $rawParam = substr($rawParam, strlen($botAccount) + 1); // 去除群组中的@ } - $rawParam = trim($rawParam); // 消除命令参数前后空格 + if (strlen($rawParam) != 0 && substr($rawParam, 0, 1) !== ' ') { break; } // 命令后必须带空格 + $rawParam = trim($rawParam); // 消除前后空格 if ($isCallback) { routeCallback($cmd, $rawParam); } else { diff --git a/models/cfopPic.php b/models/cfopPic.php index 7c03831..fed6aa0 100644 --- a/models/cfopPic.php +++ b/models/cfopPic.php @@ -91,4 +91,4 @@ function cfopPicCallback($rawParam) { // 发送CFOP图片回调入口 sendAuto($chatId, (new cfopPic)->getPic($rawParam)); } -?> \ No newline at end of file +?> diff --git a/models/ipInfo.php b/models/ipInfo.php index f1db2db..3f3aca4 100644 --- a/models/ipInfo.php +++ b/models/ipInfo.php @@ -164,4 +164,4 @@ function ipInfoCallback($rawParam) { // IP查询回调入口 } } -?> \ No newline at end of file +?> diff --git a/models/tgDC.php b/models/tgDC.php index aff4125..cc87c6a 100644 --- a/models/tgDC.php +++ b/models/tgDC.php @@ -172,7 +172,7 @@ function tgDC($rawParam) { // DC查询入口 } sendMessage($chatId, (new tgDC)->getInfo($userAccount)); // 查询并返回数据 if ($isGroup) { return; } - sleep(20); + sleep(15); sendPayload(array( // 删除帮助信息 'method' => 'deleteMessage', 'chat_id' => $chatId, @@ -180,4 +180,4 @@ function tgDC($rawParam) { // DC查询入口 )); } -?> \ No newline at end of file +?>