Пример #1
0
    def member(self):
        """
        * 若消息来自群聊,则此属性为消息的实际发送人(具体的群成员)
        * 若消息来自其他聊天对象(非群聊),则此属性为 None
        """

        if isinstance(self.chat, Group):
            actual_user_name = self.raw.get('ActualUserName')
            for _member in self.chat:
                if _member.user_name == actual_user_name:
                    return _member
            return Member(dict(UserName=actual_user_name, NickName=self.raw.get('ActualNickName')), self.chat)
Пример #2
0
    def member(self):
        """
        若消息来自群聊,则此属性为实际发送消息的群成员
        """

        if isinstance(self.sender, Group):
            actual_user_name = self.raw.get('ActualUserName')
            for _member in self.sender:
                if _member.user_name == actual_user_name:
                    return _member
            return Member(
                dict(UserName=actual_user_name,
                     NickName=self.raw.get('ActualNickName')), self.sender)
Пример #3
0
    def member(self):
        """
        * 若消息来自群聊,则此属性为消息的实际发送人(具体的群成员)
        * 若消息来自其他聊天对象(非群聊),则此属性为 None
        
        :rtype: NoneType, :class:`wxpy.Member`
        """

        if isinstance(self.chat, Group):
            if self.sender == self.bot.self:
                return self.chat.self
            else:
                actual_user_name = self.raw.get('ActualUserName')
                for _member in self.chat.members:
                    if _member.user_name == actual_user_name:
                        return _member
                return Member(
                    dict(UserName=actual_user_name,
                         NickName=self.raw.get('ActualNickName')), self.chat)