Пример #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)
Пример #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)
Пример #3
0
 def test_remove_mentions(self):
     cleaned = gitter.remove_mentions('Hi @person how are you @myfriend')
     self.assertEqual(cleaned, 'Hi how are you')
Пример #4
0
 def test_remove_mentions(self):
     cleaned = gitter.remove_mentions('Hi @person how are you @myfriend')
     self.assertEqual(cleaned, 'Hi how are you')