Exemplo n.º 1
0
    def process_input(self, statement):
        new_message = False

        while not new_message:
            data = gitter.get_most_recent_message(self.gitter_api_token,
                                                  self.room_id)
            if gitter.should_respond(data, self.username,
                                     self.only_respond_to_mentions):
                gitter.mark_messages_as_read(self.gitter_api_token,
                                             self.user_id, self.room_id,
                                             [data['id']])
                new_message = True
            sleep(self.sleep_time)

        text = gitter.remove_mentions(data['text'])

        return Statement(text=text)
Exemplo n.º 2
0
    def process_input(self, statement):
        new_message = False

        while not new_message:
            data = gitter.get_most_recent_message(self.gitter_api_token, self.room_id)
            if gitter.should_respond(data, self.username, self.only_respond_to_mentions):
                gitter.mark_messages_as_read(
                    self.gitter_api_token,
                    self.user_id,
                    self.room_id,
                    [data['id']]
                )
                new_message = True
            sleep(self.sleep_time)

        text = gitter.remove_mentions(data['text'])

        return Statement(text=text)
Exemplo n.º 3
0
 def test_get_most_recent_message(self):
     room_id = '40999743'
     data = gitter.get_most_recent_message('fake_access_token', room_id)
     self.assertIn('text', data)
     self.assertIn('id', data)
     self.assertIn('unread', data)
Exemplo n.º 4
0
 def test_get_most_recent_message(self):
     room_id = '40999743'
     data = gitter.get_most_recent_message('fake_access_token', room_id)
     self.assertIn('text', data)
     self.assertIn('id', data)
     self.assertIn('unread', data)