djangobot/client.py
def translate(self, message):
        """
        Translate machine identifiers into human-readable
        """
        # translate user
        try:
            user_id = message.pop('user')
            user = self.slack.user_from_id(user_id)
            message[u'user'] = user['name']
        except (KeyError, IndexError, ValueError):
            pass
        # translate channel
        try:
            if type(message['channel']) == str:
                channel_id = message.pop('channel')
            else:
                channel_id = message.pop('channel')['id']
                self.slack.reload_channels()
            channel = self.slack.channel_from_id(channel_id)
            message[u'channel'] = channel['name']
        except (KeyError, IndexError, ValueError):
            pass
        return message
def translate(self, message):
        """
        Translate machine identifiers into human-readable
        """
        # translate user
        try:
            user_id = message.pop('user')
            user = self.slack.user_from_id(user_id)
            message[u'user'] = user['name']
        except (KeyError, IndexError, ValueError):
            pass
        # translate channel
        try:
            if type(message['channel']) == str:
                channel_id = message.pop('channel')
            else:
                channel_id = message.pop('channel')['id']
                self.slack.reload_channels()
            channel = self.slack.channel_from_id(channel_id)
            message[u'channel'] = channel['name']
        except (KeyError, IndexError, ValueError):
            pass
        return message
def translate ( self , message ) : # translate user try : user_id = message . pop ( 'user' ) user = self . slack . user_from_id ( user_id ) message [ u'user' ] = user [ 'name' ] except ( KeyError , IndexError , ValueError ) : pass # translate channel try : if type ( message [ 'channel' ] ) == str : channel_id = message . pop ( 'channel' ) else : channel_id = message . pop ( 'channel' ) [ 'id' ] self . slack . reload_channels ( ) channel = self . slack . channel_from_id ( channel_id ) message [ u'channel' ] = channel [ 'name' ] except ( KeyError , IndexError , ValueError ) : pass return message
Translate machine identifiers into human-readable
Translate machine identifiers into human - readable