fix : 链接和加群时机

This commit is contained in:
Wbucket
2026-10-01 11:41:37 +08:00
parent 87551ee358
commit 8ad83d2a7e
+17 -10
View File
@@ -105,10 +105,13 @@ class djtuWebsocket (Client) :
logger.warning("data解析失败") logger.warning("data解析失败")
return return
logger.info("入群信息:"+' 群: '+openid+" openid: "+memberid) logger.info("入群信息:"+' 群: '+openid+" openid: "+memberid)
await self.api.post_group_message(openid,event_id=eid,content='欢迎加入大海啸!\n入服教程请看链接:\nhttps://starptr.top') await self.api.post_group_message(openid,event_id=eid,content='欢迎加入大海啸!\n入服教程请看链接:\nhttps://hiso.wgfire.top/archives/ifnew')
# 触发概率不大所以可以直接提取关键字 # 触发概率不大所以可以直接提取关键字
async def parseCommand(self,msg :Message): async def parseCommand(self,msg :GroupMessage):
# 加入群聊
if msg.group_openid:
self.group_add(msg.group_openid)
commands:dict[str,types.MethodType|types.FunctionType] = { commands:dict[str,types.MethodType|types.FunctionType] = {
r'/邀请码' : bobby.getInviteCode, r'/邀请码' : bobby.getInviteCode,
r'吃什么' : lambda :"是啊吃什么" r'吃什么' : lambda :"是啊吃什么"
@@ -126,14 +129,7 @@ class djtuWebsocket (Client) :
reply = "你在发什么东西我怎么看不懂?" reply = "你在发什么东西我怎么看不懂?"
await msg.reply(content=reply) await msg.reply(content=reply)
# 触发概率大,以后要做好解析防止刷屏 def group_add(self,gid :str):
async def parseGlobalMessage(self,payload):
try :
msg = payload['d']
gid = msg['group_id']
content = msg['content']
except:
return
# 加入群聊 # 加入群聊
new_group = True new_group = True
if not groups is None : if not groups is None :
@@ -143,6 +139,17 @@ class djtuWebsocket (Client) :
if new_group : if new_group :
groups.groups.append(gid) groups.groups.append(gid)
groups.save() groups.save()
# 触发概率大,以后要做好解析防止刷屏
async def parseGlobalMessage(self,payload):
try :
msg = payload['d']
gid = msg['group_id']
content = msg['content']
except:
return
# 群聊加入
self.group_add(gid)
# 解析指令 # 解析指令
commands:dict[str,types.MethodType|types.FunctionType] = { commands:dict[str,types.MethodType|types.FunctionType] = {
r'吃什么' : lambda :"是啊吃什么" r'吃什么' : lambda :"是啊吃什么"