mirror of
https://github.com/RockChinQ/QChatGPT.git
synced 2024-11-16 03:32:33 +08:00
feat: 支持设置群内回复时at发送者
This commit is contained in:
parent
3577e62b41
commit
a6cbd226e1
|
@ -152,7 +152,6 @@ response_rules = {
|
|||
}
|
||||
|
||||
|
||||
|
||||
# 消息忽略规则
|
||||
# 适用于私聊及群聊
|
||||
# 符合此规则的消息将不会被响应
|
||||
|
@ -238,6 +237,9 @@ image_api_params = {
|
|||
# 群内回复消息时是否引用原消息
|
||||
quote_origin = True
|
||||
|
||||
# 群内回复消息时是否at发送者
|
||||
at_sender = False
|
||||
|
||||
# 回复绘图时是否包含图片描述
|
||||
include_image_description = True
|
||||
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue
Block a user