Get mention if a Chat has a username, or get full name if this is a Private Chat, otherwise None is returned
766699
def mention(self):
        
        if self.username:
            return '@' + self.username
        if self.type == ChatType.PRIVATE:
            return self.full_name
        return None
938770
def get_extra_info(self, username):
        
        url = self._get_extra_info_url(username)
        return make_request(url, timeout=self.timeout)
1033331
function(userId, appId) {
        if(!appId){
            return userId + '-' + config.creds.appId + '@' + config.endpoints.chat;
        }
        return userId + '-' + appId + '@' + config.endpoints.chat;
    }
500191
async def cmd_id(message: types.Message):
    
    if message.reply_to_message:
        target = message.reply_to_message.from_user
        chat = message.chat
    elif message.forward_from and message.chat.type == ChatType.PRIVATE:
        target = message.forward_from
        chat = message.forward_from or message.chat
    else:
        target = message.from_user
        chat = message.chat

    result_msg = [hbold('Info about user:'),
                  f"First name: {target.first_name}"]
    if target.last_name:
        result_msg.append(f"Last name: {target.last_name}")
    if target.username:
        result_msg.append(f"Username: {target.mention}")
    result_msg.append(f"User ID: {target.id}")

    result_msg.extend([hbold('Chat:'),
                       f"Type: {chat.type}",
                       f"Chat ID: {chat.id}"])
    if chat.type != ChatType.PRIVATE:
        result_msg.append(f"Title: {chat.title}")
    else:
        result_msg.append(f"Title: {chat.full_name}")
    return SendMessage(message.chat.id, '\n'.join(result_msg), reply_to_message_id=message.message_id,
                       parse_mode=ParseMode.HTML)
834491
def _get_member_ref_str(name, obj, role='obj', known_refs=None):
    """"""
    if known_refs is not None:
        if name in known_refs:
            return known_refs[name]
    ref = _get_fullname(name, obj)
    return ":%s:`%s <%s>`" % (role, name, ref)
1136772
def get_user_details(self, response):
        
        result = {
            'id': response['id'],
            'username': response.get('username', None),
            'email': response.get('email', None),
            'first_name': response.get('first_name', None),
            'last_name': response.get('last_name', None)
        }
        if result['first_name'] and result['last_name']:
            result['fullname'] = result['first_name'] + \
                ' ' + result['last_name']
        return result
362942
def getChatAdministrators(self, chat_id):
        
        p = _strip(locals())
        return self._api_request('getChatAdministrators', _rectify(p))
734916
def __parse_direct_mention(self, message_text):
        
        matches = re.search(MENTION_REGEX, message_text)
        # the first group contains the username, the second group contains the remaining message
        return (matches.group(1), listify(matches.group(2).strip())) if matches else (None, None)
45352
def chat_show(self, chat_id, **kwargs):
        ""
        api_path = "/api/v2/chats/{chat_id}"
        api_path = api_path.format(chat_id=chat_id)
        return self.call(api_path, **kwargs)
693866
def get_member_details(self, username):
        
        members = self.get_members()
        for member in members:
            if member.username == username:
                return member
791884
def _get_userinfo(self):
        
        if not hasattr(self, "_userinfo"):
            userinfo = {
                "name": self.user_name,
                "email": self.user_email,
                "url": self.user_url
            }
            if self.user_id:
                u = self.user
                if u.email:
                    userinfo["email"] = u.email

                # If the user has a full name, use that for the user name.
                # However, a given user_name overrides the raw user.username,
                # so only use that if this comment has no associated name.
                if u.get_full_name():
                    userinfo["name"] = self.user.get_full_name()
                elif not self.user_name:
                    userinfo["name"] = u.get_username()
            self._userinfo = userinfo
        return self._userinfo
895025
def _handle_chat_name(self, data):
        """"""

        self.room.user.nick = data
        self.conn.enqueue_data("user", self.room.user)
319297
async def setChatDescription(self, chat_id,
                                 description=None):
        
        p = _strip(locals())
        return await self._api_request('setChatDescription', _rectify(p))
657254
def setHookName(self, name: str):
        
        self.isHook = True
        self.messengerName = name
1231595
def display_name(self):
        
        for k in self._NAME_KEYS:
            if self._raw.get(k):
                return self._raw[k]
            if "profile" in self._raw and self._raw["profile"].get(k):
                return self._raw["profile"][k]
        return self._raw["name"]
264164
def get_user_details(self, response):
        """"""
        email = response['email']
        username = response.get('nickname', email).split('@', 1)[0]
        return {'username': username,
                'email': email,
                'fullname': '',
                'first_name': '',
                'last_name': ''}
858531
async def on_message(message):
    

    # Simplify message info
    server = message.server
    author = message.author
    channel = message.channel
    content = message.content

    data = datatools.get_data()

    if not data["discord"]["servers"][server.id][_data.modulename]["activated"]:
        return

    # Only reply to server messages and don't reply to myself
    if server is not None and author != channel.server.me:
        # Retrieve replies from server data
        normal_replies = data["discord"]["servers"][server.id][_data.modulename]["normal"]
        tts_replies = data["discord"]["servers"][server.id][_data.modulename]["tts"]

        # Check normal replies
        for r in normal_replies.keys():
            if r in content.lower().replace(' ', ''):
                await client.send_typing(channel)
                await client.send_message(channel, normal_replies[r])

        # Check tts replies
        for r in tts_replies.keys():
            if r in content.lower().replace(' ', ''):
                await client.send_typing(channel)
                await client.send_message(channel, tts_replies[r])