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)
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)
def test_remove_mentions(self): cleaned = gitter.remove_mentions('Hi @person how are you @myfriend') self.assertEqual(cleaned, 'Hi how are you')