def build_efb_chat_as_anonymous_user(self, chat: Chat, context): anonymous_data = context['anonymous'] member_uid = 'anonymous' + '_' + anonymous_data['flag'] with contextlib.suppress(KeyError): return chat.get_member(member_uid) chat_name = '[Anonymous] ' + anonymous_data['name'] return chat.add_member( name=str(chat_name), alias=None if 'alias' not in context else str(context['alias']), uid=str(member_uid), vendor_specific={ 'is_anonymous': True, 'anonymous_id': anonymous_data['id'] })
def build_or_get_efb_member(self, chat: Chat, context): member_uid = context['user_id'] with contextlib.suppress(KeyError): return chat.get_member(str(member_uid)) chat_name = '' if 'nickname' not in context: i: dict = self.channel.QQClient.get_stranger_info(member_uid) chat_name = "" if i: chat_name = i['nickname'] else: chat_name = context['nickname'] return chat.add_member( name=str(chat_name), alias=None if 'alias' not in context else str(context['alias']), uid=str(member_uid))