Browse Source

fix: force a space after command

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

5
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 {

2
models/cfopPic.php

@ -91,4 +91,4 @@ function cfopPicCallback($rawParam) { // 发送CFOP图片回调入口
sendAuto($chatId, (new cfopPic)->getPic($rawParam));
}
?>
?>

2
models/ipInfo.php

@ -164,4 +164,4 @@ function ipInfoCallback($rawParam) { // IP查询回调入口
}
}
?>
?>

4
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查询入口
));
}
?>
?>

Loading…
Cancel
Save