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

对于新号,还没有私信过的,获取到的groups没有GroupType.PRIVATE_MSG,则设置不了priv_gid,mid_manager get message id会出错 #223

Closed
LoneKingCode opened this issue Aug 12, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@LoneKingCode
Copy link

LoneKingCode commented Aug 12, 2024

简要描述这个bug

client.py

        # 新号的groups是没有GroupType.PRIVATE_MSG的,所以priv_gid 就设置不到 为None
        groups = await init_websocket.request(self._ws_core)
        mid_manager = self._ws_core.mid_manager
        for group in groups:
            if group.group_type == GroupType.PRIVATE_MSG:
                mid_manager.priv_gid = group.group_id
        mid_manager.gid2mid = {g.group_id: MsgIDPair(g.last_msg_id, g.last_msg_id) for g in groups}
        # 目前我是自己写了个这默认值
        if mid_manager.priv_gid==None:
            mid_manager.priv_gid=1234567890
            mid_manager.gid2mid[1234567890]=MsgIDPair(1234567890, 1234567890)
            print('mid_manager.priv_gid use default:1234567890')

...

如何复现

在何种场景下用何种操作复现

你希望程序作出何种行为

...

截图(可选)

...

@lumina37
Copy link
Owner

意思是,如果获取不到priv_gid,就应该填一个默认值进去?我下班了回去看看

@n0099
Copy link

n0099 commented Aug 13, 2024

阁下毕业了? https://z.n0099.net/#narrow/near/82878 #115 (comment)

@lumina37
Copy link
Owner

阁下毕业了? https://z.n0099.net/#narrow/near/82878 #115 (comment)

在某厂牌实习打碟技术

@lumina37 lumina37 added the bug Something isn't working label Aug 13, 2024
@LoneKingCode
Copy link
Author

LoneKingCode commented Aug 13, 2024

意思是,如果获取不到priv_gid,就应该填一个默认值进去?我下班了回去看看

是的,没有priv_gid的话,mid_manager的get_record_id方法里是 return xxx[priv_gid]
就直接报错了 key error,发私信时要获取个唯一id

只有完全的新账户才有这情况,groups里没有GroupType.PRIVATE_MSG
当时看到这错误不太正常,调了下程序 查到了这里

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants