def _bot_identifier(self, message):
        """Return the identifier used to address this bot in this message.
        If one is not found, return None.

        :param message: a message dict from the slack api.
        """

        text = message['text']

        formatters = [
            lambda identifier: "%s " % identifier,
            lambda identifier: "%s:" % identifier,
        ]
        my_identifiers = [formatter(identifier) for identifier in [self.name, self.my_mention] for formatter in formatters]

        for identifier in my_identifiers:
            if text.startswith(identifier):
                self.log.debug("sent to me:\n%s", pprint.pformat(message))
                return identifier

        return None
def _bot_identifier ( self , message ) : text = message [ 'text' ] formatters = [ lambda identifier : "%s " % identifier , lambda identifier : "%s:" % identifier , ] my_identifiers = [ formatter ( identifier ) for identifier in [ self . name , self . my_mention ] for formatter in formatters ] for identifier in my_identifiers : if text . startswith ( identifier ) : self . log . debug ( "sent to me:\n%s" , pprint . pformat ( message ) ) return identifier return None
Return the identifier used to address this bot in this message.
        If one is not found, return None.

        :param message: a message dict from the slack api.