warn about encryption failure
This commit is contained in:
parent
4271e2668f
commit
7dc2bf12b6
|
@ -5,7 +5,7 @@ import time
|
|||
from nio import (AsyncClient, InviteMemberEvent, JoinError, MatrixRoom, MegolmEvent, RoomMessageText, UnknownEvent, )
|
||||
|
||||
from .bot_commands import Command
|
||||
from .chat_functions import check_authorized, get_thread_content, is_thread, process_chat, react_to_event
|
||||
from .chat_functions import check_authorized, get_thread_content, is_thread, process_chat, react_to_event, send_text_to_room
|
||||
# from .config import Config
|
||||
from .storage import Storage
|
||||
|
||||
|
@ -75,8 +75,13 @@ class Callbacks:
|
|||
thread_content = await get_thread_content(self.client, room, event)
|
||||
api_data = []
|
||||
for event in thread_content:
|
||||
api_data.append({'role': 'assistant' if event.sender == self.client.user_id else 'user', 'content': event.body if not event.body.startswith(self.command_prefix) else event.body[
|
||||
len(self.command_prefix):].strip()}) # if len(thread_content) >= 2 and thread_content[0].body.startswith(self.command_prefix): # if thread_content[len(thread_content) - 2].sender == self.client.user
|
||||
if isinstance(event, MegolmEvent):
|
||||
await send_text_to_room(self.client, room.room_id, 'Decryption Failure', reply_to_event_id=event.event_id, thread=True, thread_root_id=thread_content[0].event_id)
|
||||
else:
|
||||
api_data.append({
|
||||
'role': 'assistant' if event.sender == self.client.user_id else 'user',
|
||||
'content': event.body if not event.body.startswith(self.command_prefix) else event.body[len(self.command_prefix):].strip()
|
||||
}) # if len(thread_content) >= 2 and thread_content[0].body.startswith(self.command_prefix): # if thread_content[len(thread_content) - 2].sender == self.client.user
|
||||
|
||||
# message = Message(self.client, self.store, msg, room, event, self.reply_in_thread)
|
||||
# await message.process()
|
||||
|
|
Loading…
Reference in New Issue