Browse Source

fix: force a space after command

master
Dnomd343 3 years ago
parent
commit
da990d095f
  1. 5
      main.php
  2. 2
      models/tgDC.php

5
main.php

@ -34,9 +34,10 @@ foreach ($cmds as $cmd) {
if (strpos($messageText, '/' . $cmd) === 0) { // 判断请求开头 if (strpos($messageText, '/' . $cmd) === 0) { // 判断请求开头
$rawParam = substr($messageText, strlen($cmd) + 1); // 获取请求参数 $rawParam = substr($messageText, strlen($cmd) + 1); // 获取请求参数
if ($isGroup && strpos($rawParam, '@' . $botAccount) === 0) { 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) { if ($isCallback) {
routeCallback($cmd, $rawParam); routeCallback($cmd, $rawParam);
} else { } else {

2
models/tgDC.php

@ -172,7 +172,7 @@ function tgDC($rawParam) { // DC查询入口
} }
sendMessage($chatId, (new tgDC)->getInfo($userAccount)); // 查询并返回数据 sendMessage($chatId, (new tgDC)->getInfo($userAccount)); // 查询并返回数据
if ($isGroup) { return; } if ($isGroup) { return; }
sleep(20); sleep(15);
sendPayload(array( // 删除帮助信息 sendPayload(array( // 删除帮助信息
'method' => 'deleteMessage', 'method' => 'deleteMessage',
'chat_id' => $chatId, 'chat_id' => $chatId,

Loading…
Cancel
Save