Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

避免 get_user_ingroup 無法獲取結果導致崩潰 #41

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/qqbot.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class QQBot

# 获取群用户信息
get_user_ingroup: (uin, gid)->
if !@groupmember_info[gid] then return null
info = @groupmember_info[gid]
users = info.minfo.filter (item)-> item.uin == uin
users.pop()
Expand Down Expand Up @@ -103,7 +104,7 @@ class QQBot
# @callback (ret:bool , error)
update_group_member: (options, callback)->
group = if options.code then options else @get_group(options)
@api.get_group_member group.code , @auth , (ret,e)=>
@api.get_group_member (group or {}).code , @auth , (ret,e)=>
if ret.retcode == 0
@save_group_member(group,ret.result)
callback(ret.retcode == 0 , e) if callback
Expand Down Expand Up @@ -401,6 +402,7 @@ class QQBot
uid : value.msg_id

if msg_type == MsgType.Group
msg.gnum = value.info_seq
msg.from_gid = msg.from_uin
msg.group_code = value.group_code
msg.from_uin = value.send_uin # 这才是用户,group消息中 from_uin 是gid
Expand Down