feat: 支持设置群内回复时at发送者

This commit is contained in:
RockChinQ 2023-08-01 10:13:15 +08:00
parent 3577e62b41
commit a6cbd226e1
2 changed files with 21 additions and 3 deletions

View File

@ -152,7 +152,6 @@ response_rules = {
}
# 消息忽略规则
# 适用于私聊及群聊
# 符合此规则的消息将不会被响应
@ -238,6 +237,9 @@ image_api_params = {
# 群内回复消息时是否引用原消息
quote_origin = True
# 群内回复消息时是否at发送者
at_sender = False
# 回复绘图时是否包含图片描述
include_image_description = True

View File

@ -264,8 +264,24 @@ class QQBotManager:
else:
self.reply_filter = pkg.qqbot.filter.ReplyFilter([])
def send(self, event, msg, check_quote=True):
def send(self, event, msg, check_quote=True, check_at_sender=True):
config = pkg.utils.context.get_config()
if check_at_sender and config.at_sender:
msg.insert(
0,
Plain(" \n")
)
# 当回复的正文中包含换行时quote可能会自带at此时就不再单独添加at只添加换行
if "\n" not in str(msg[1]) or config.msg_source_adapter == 'nakuru':
msg.insert(
0,
At(
event.sender.id
)
)
self.adapter.reply_message(
event,
msg,
@ -313,7 +329,7 @@ class QQBotManager:
reply = [tips_custom.reply_message]
if reply:
return self.send(event, reply, check_quote=False)
return self.send(event, reply, check_quote=False, check_at_sender=False)
# 群消息处理
def on_group_message(self, event: GroupMessage):