Skip to content

Commit

Permalink
Merge pull request zhayujie#2114 from 6vision/fix_dingtalk_group_chat
Browse files Browse the repository at this point in the history
fix: dingtalk channel group chat bug
  • Loading branch information
zhayujie authored Jun 27, 2024
2 parents 3afd99d + 91f5ffb commit b9e84fe
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions channel/chat_channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ def _compose_context(self, ctype: ContextType, content, **kwargs):
logger.info("[chat_channel]receive group at")
if not conf().get("group_at_off", False):
flag = True
self.name = self.name if self.name is not None else "" # 部分渠道self.name可能没有赋值
pattern = f"@{re.escape(self.name)}(\u2005|\u0020)"
subtract_res = re.sub(pattern, r"", content)
if isinstance(context["msg"].at_list, list):
Expand Down
2 changes: 1 addition & 1 deletion channel/dingtalk/dingtalk_channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def handle_group(self, cmsg: DingTalkMessage):
elif cmsg.ctype == ContextType.PATPAT:
logger.debug("[DingTalk]receive patpat msg: {}".format(cmsg.content))
elif cmsg.ctype == ContextType.TEXT:
logger.debug("[DingTalk]receive patpat msg: {}".format(cmsg.content))
logger.debug("[DingTalk]receive text msg: {}".format(cmsg.content))
else:
logger.debug("[DingTalk]receive other msg: {}".format(cmsg.content))
context = self._compose_context(cmsg.ctype, cmsg.content, isgroup=True, msg=cmsg)
Expand Down
1 change: 1 addition & 0 deletions channel/dingtalk/dingtalk_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ def __init__(self, event: ChatbotMessage, image_download_handler):
if self.is_group:
self.from_user_id = event.conversation_id
self.actual_user_id = event.sender_id
self.is_at = True
else:
self.from_user_id = event.sender_id
self.actual_user_id = event.sender_id
Expand Down

0 comments on commit b9e84fe

Please sign in to comment.