no message
This commit is contained in:
parent
d0a3343811
commit
3ab633fbf3
@ -37,7 +37,7 @@ final class HookController
|
||||
$aData['fromId'] = $aUpdate["message"]["from"]["id"];
|
||||
|
||||
if (!isset($aUpdate["message"]["text"])) {
|
||||
Http::response(200, 'not have text');
|
||||
throw new \Exception("?");
|
||||
}
|
||||
|
||||
$sText = $aUpdate["message"]["text"];
|
||||
@ -51,24 +51,15 @@ final class HookController
|
||||
// $sText = "////Article#Add jxxjjjj";
|
||||
// $sText = "//\\\//Article#Del 9";
|
||||
// $sText = "/Article#Set__1__user_name xxx";
|
||||
// $sText = "$ cmd#list__si__sk 234";
|
||||
|
||||
// 拆分后直接
|
||||
@$aArg = explode(" ", $sText);
|
||||
|
||||
// if ($aArg[0] != '$') {
|
||||
// exit();
|
||||
// }
|
||||
|
||||
unset($aArg[0]); // 丢掉$
|
||||
|
||||
$aArg = array_values($aArg);
|
||||
|
||||
@$aOption = explode("__", $aArg[0]);
|
||||
|
||||
$sCmd = $this->cleanCmd($aOption[0]);
|
||||
|
||||
list($sClass, $sFunc) = explode("#", $sCmd);
|
||||
$sClass = ucfirst($sClass);
|
||||
$sFunc = ucfirst($sFunc);
|
||||
|
||||
unset($aOption[0]);
|
||||
unset($aArg[0]);
|
||||
@ -84,19 +75,16 @@ final class HookController
|
||||
$r = $oInstans->$sFunc($aParams);
|
||||
|
||||
} else {
|
||||
$oTGHttp->sendToTG("没有这个方法");
|
||||
throw new \Exception("没有这个方法");
|
||||
}
|
||||
|
||||
|
||||
} catch (\Throwable $e) {
|
||||
|
||||
$sMessage = "错误: " . $e->getMessage();
|
||||
|
||||
$oTGHttp->sendToTG($sMessage);
|
||||
|
||||
Http::response(200, 'error');
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private function cleanCmd($input) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user