mirror of
https://github.com/langbot-app/LangBot.git
synced 2025-11-26 03:44:58 +08:00
feat: 支持设置群内回复时at发送者
This commit is contained in:
@@ -152,7 +152,6 @@ response_rules = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# 消息忽略规则
|
# 消息忽略规则
|
||||||
# 适用于私聊及群聊
|
# 适用于私聊及群聊
|
||||||
# 符合此规则的消息将不会被响应
|
# 符合此规则的消息将不会被响应
|
||||||
@@ -238,6 +237,9 @@ image_api_params = {
|
|||||||
# 群内回复消息时是否引用原消息
|
# 群内回复消息时是否引用原消息
|
||||||
quote_origin = True
|
quote_origin = True
|
||||||
|
|
||||||
|
# 群内回复消息时是否at发送者
|
||||||
|
at_sender = False
|
||||||
|
|
||||||
# 回复绘图时是否包含图片描述
|
# 回复绘图时是否包含图片描述
|
||||||
include_image_description = True
|
include_image_description = True
|
||||||
|
|
||||||
|
|||||||
@@ -264,8 +264,24 @@ class QQBotManager:
|
|||||||
else:
|
else:
|
||||||
self.reply_filter = pkg.qqbot.filter.ReplyFilter([])
|
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()
|
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(
|
self.adapter.reply_message(
|
||||||
event,
|
event,
|
||||||
msg,
|
msg,
|
||||||
@@ -313,7 +329,7 @@ class QQBotManager:
|
|||||||
reply = [tips_custom.reply_message]
|
reply = [tips_custom.reply_message]
|
||||||
|
|
||||||
if reply:
|
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):
|
def on_group_message(self, event: GroupMessage):
|
||||||
|
|||||||
Reference in New Issue
Block a user