fix: 修复 qq 回复别人的时候也会触发机器人, Onebot at 使用 string #330
This commit is contained in:
@@ -3,7 +3,7 @@ from ..context import PipelineContext
|
||||
from typing import Union, AsyncGenerator
|
||||
from astrbot.core.platform.astr_message_event import AstrMessageEvent
|
||||
from astrbot.core.message.message_event_result import MessageEventResult, MessageChain
|
||||
from astrbot.core.message.components import At
|
||||
from astrbot.core.message.components import At, Reply
|
||||
from astrbot.core.star.star_handler import star_handlers_registry, EventType
|
||||
from astrbot.core.star.filter.command_group import CommandGroupFilter
|
||||
from astrbot.core.star.filter.permission import PermissionTypeFilter
|
||||
@@ -43,7 +43,7 @@ class WakingCheckStage(Stage):
|
||||
if event.message_str.startswith(wake_prefix):
|
||||
if (
|
||||
not event.is_private_chat()
|
||||
and isinstance(messages[0], At)
|
||||
and (isinstance(messages[0], At) or isinstance(messages[0], Reply))
|
||||
and str(messages[0].qq) != str(event.get_self_id())
|
||||
and str(messages[0].qq) != "all"
|
||||
):
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
import os
|
||||
import random
|
||||
import asyncio
|
||||
|
||||
from astrbot.api.event import AstrMessageEvent, MessageChain
|
||||
from astrbot.api.message_components import Plain, Image, Record
|
||||
from astrbot.api.message_components import Plain, Image, Record, At
|
||||
from aiocqhttp import CQHttp
|
||||
from astrbot.core.utils.io import file_to_base64, download_image_by_url
|
||||
|
||||
@@ -33,6 +31,10 @@ class AiocqhttpMessageEvent(AstrMessageEvent):
|
||||
d['data'] = {
|
||||
'file': bs64_data,
|
||||
}
|
||||
if isinstance(segment, At):
|
||||
d['data'] = {
|
||||
'qq': str(segment.qq) # 转换为字符串
|
||||
}
|
||||
ret.append(d)
|
||||
return ret
|
||||
|
||||
|
||||
Reference in New Issue
Block a user