From a935b085d40c678f25b86136db6326c9b0fe8948 Mon Sep 17 00:00:00 2001 From: Soulter <37870767+Soulter@users.noreply.github.com> Date: Tue, 11 Apr 2023 10:23:25 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20QQ=E5=B9=B3=E5=8F=B0=E6=94=AF=E6=8C=81@?= =?UTF-8?q?=E6=9C=BA=E5=99=A8=E4=BA=BA=E6=97=B6=E5=9B=9E=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cores/qqbot/core.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/cores/qqbot/core.py b/cores/qqbot/core.py index d92056a2..68741358 100644 --- a/cores/qqbot/core.py +++ b/cores/qqbot/core.py @@ -18,8 +18,9 @@ from model.platform.qq import QQ from nakuru import ( CQHTTP, GroupMessage, + GroupMemberIncrease ) -from nakuru.entities.components import Plain +from nakuru.entities.components import Plain,At # QQBotClient实例 client = '' @@ -611,11 +612,18 @@ class gocqClient(): # 收到群聊消息 @gocq_app.receiver("GroupMessage") async def _(app: CQHTTP, source: GroupMessage): - # 检测到有人加入了群 - # print(source) + # 如果at了本机器人 if isinstance(source.message[0], Plain): if source.message[0].text.startswith('ai '): source.message[0].text = source.message[0].text[3:] new_sub_thread(oper_msg, (source, True, None, PLATFORM_GOCQ)) + if isinstance(source.message[0], At): + if source.message[0].text.startswith('ai '): + source.message[0].text = source.message[0].text[3:] + new_sub_thread(oper_msg, (source, True, None, PLATFORM_GOCQ)) else: - return \ No newline at end of file + return + + @gocq_app.receiver("GroupMemberIncrease") + async def _(app: CQHTTP, source: GroupMemberIncrease): + await app.send_group_msg(group_id=source.group_id, message=f"欢迎 {source.member_id} 加入本群!\n欢迎给https://github.com/Soulter/QQChannelChatGPT项目一个Star😊~") \ No newline at end of file