From 7f27957164df36a9f07dbac8c57961e11a27bc1a Mon Sep 17 00:00:00 2001 From: Reverier-Xu Date: Wed, 10 Mar 2021 01:40:37 +0800 Subject: [PATCH] :boom: change cqhttp ding session id --- .../nonebot-adapter-cqhttp/nonebot/adapters/cqhttp/event.py | 4 ++++ packages/nonebot-adapter-ding/nonebot/adapters/ding/event.py | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/packages/nonebot-adapter-cqhttp/nonebot/adapters/cqhttp/event.py b/packages/nonebot-adapter-cqhttp/nonebot/adapters/cqhttp/event.py index 53497870..e0551279 100644 --- a/packages/nonebot-adapter-cqhttp/nonebot/adapters/cqhttp/event.py +++ b/packages/nonebot-adapter-cqhttp/nonebot/adapters/cqhttp/event.py @@ -199,6 +199,10 @@ class GroupMessageEvent(MessageEvent): if x.is_text() else f"{escape_tag(str(x))}", self.message)) + '"') + @overrides(MessageEvent) + def get_session_id(self) -> str: + return f"group_{self.group_id}_{self.user_id}" + # Notice Events class NoticeEvent(Event): diff --git a/packages/nonebot-adapter-ding/nonebot/adapters/ding/event.py b/packages/nonebot-adapter-ding/nonebot/adapters/ding/event.py index 7dfdc2e1..e01588a6 100644 --- a/packages/nonebot-adapter-ding/nonebot/adapters/ding/event.py +++ b/packages/nonebot-adapter-ding/nonebot/adapters/ding/event.py @@ -143,3 +143,7 @@ class GroupMessageEvent(MessageEvent): @overrides(MessageEvent) def is_tome(self) -> bool: return self.isInAtList + + @overrides(MessageEvent) + def get_session_id(self) -> str: + return f"group_{self.conversationId}_{self.senderId}"