Merge pull request #45 from YuFengZe/master

Bug Fixed
This commit is contained in:
Jerry Ma 2021-10-31 22:50:49 +08:00 committed by GitHub
commit e4561d69c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,6 +10,7 @@ use ZM\Annotation\Swoole\OnOpenEvent;
use ZM\Annotation\Swoole\OnRequestEvent;
use ZM\API\CQ;
use ZM\API\TuringAPI;
use ZM\API\OneBotV11;
use ZM\ConnectionManager\ConnectionObject;
use ZM\Console\Console;
use ZM\Annotation\CQ\CQCommand;
@ -49,8 +50,12 @@ class Hello
* @CQCommand("我是谁")
*/
public function whoami() {
$user = ctx()->getRobot()->getLoginInfo();
return "你是" . $user["data"]["nickname"] . "QQ号是" . $user["data"]["user_id"];
$bot = ctx()->getRobot()->getLoginInfo();
$bot_id = $bot["data"]["user_id"];
$r = OneBotV11::get($bot_id);
$QQid = ctx()->getUserId();
$nick = $r->getStrangerInfo($QQid)["data"]["nickname"];
return "你是" . $nick . "QQ号是" . $QQid;
}
/**