|
@ -52,7 +52,14 @@ class ChatHistory: |
|
|
def remove(self, num_items=1): |
|
|
def remove(self, num_items=1): |
|
|
for i in range(num_items): |
|
|
for i in range(num_items): |
|
|
event_id, item = self.chat_history.popitem() |
|
|
event_id, item = self.chat_history.popitem() |
|
|
return item |
|
|
return item |
|
|
|
|
|
def remove_id(self, event_id): |
|
|
|
|
|
if event_id in self.chat_history: |
|
|
|
|
|
del self.chat_history[event_id] |
|
|
|
|
|
else: |
|
|
|
|
|
logger.warning("remove_id: could not delete event. event_id not found in chat history") |
|
|
|
|
|
def exists_id(self, event_id): |
|
|
|
|
|
return (event_id in self.chat_history) |
|
|
def add(self, event_id, timestamp, user_name, is_own_message, is_command, relates_to_event, message, language="en", english_original_message=None): |
|
|
def add(self, event_id, timestamp, user_name, is_own_message, is_command, relates_to_event, message, language="en", english_original_message=None): |
|
|
chat_message = ChatMessage(event_id, timestamp, user_name, is_own_message, is_command, relates_to_event, message, language, english_original_message) |
|
|
chat_message = ChatMessage(event_id, timestamp, user_name, is_own_message, is_command, relates_to_event, message, language, english_original_message) |
|
|
self.chat_history[chat_message.event_id] = chat_message |
|
|
self.chat_history[chat_message.event_id] = chat_message |
|
|