def publish_dm(self, dm): sender = messagetools.dm_sender(dm) recipient = messagetools.dm_recipient(dm) return self.publish_message( content=messagetools.dm_text(dm), to_addr=self.screen_name_as_addr(recipient['screen_name']), from_addr=self.screen_name_as_addr(sender['screen_name']), transport_type=self.transport_type, routing_metadata={ 'endpoint_name': self.endpoints['dms'] }, helper_metadata={ 'dm_twitter': { 'id': messagetools.dm_id(dm), 'user_mentions': messagetools.dm_user_mentions(dm), } })
def is_own_dm(self, message): sender = messagetools.dm_sender(message) return self.screen_name == messagetools.user_screen_name(sender)