From 9ce3056203484c884ea151464f25e65f9ce075ab Mon Sep 17 00:00:00 2001 From: furleywolf <50430954+furleywolf@users.noreply.github.com> Date: Mon, 13 Sep 2021 17:35:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0message-util=E7=9A=84?= =?UTF-8?q?=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 发现漏掉了一个方法,还是补上去吧 --- docs/component/bot/message-util.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docs/component/bot/message-util.md b/docs/component/bot/message-util.md index 0170a2a7..824e5523 100644 --- a/docs/component/bot/message-util.md +++ b/docs/component/bot/message-util.md @@ -42,6 +42,21 @@ MessageUtil::containsImage("[CQ:image,file=a.jpg,url=http://xxx]"); // true MessageUtil::containsImage("[CQ:face,id=140] 咦,这是一条带表情的消息"); // false ``` +### isAtMe() + +检查消息中是否含有@bot的消息。 + +定义:`isAtMe($msg, $me_id)` + +参数 `$me_id` 为Bot的QQ号。 + +返回:`bool`,true 就是有,false 就没有。 + +```php +MessageUtil::isAtMe("[CQ:at,qq=123456]炸毛你好","123456"); // true +MessageUtil::isAtMe("[CQ:at,qq=123456789]另一个朋友你好","123456"); // false +``` + ### getImageCQFromLocal() 通过文件路径获取图片的发送 CQ 码。