shieeeet mayn
This commit is contained in:
parent
e37ef3a3b0
commit
3753ce7944
|
@ -11,7 +11,6 @@ from .handle_actions import do_reply_msg, do_reply_threaded_msg, do_join_channel
|
|||
from .matrix import MatrixClientHelper
|
||||
|
||||
|
||||
|
||||
class MatrixBotCallbacks:
|
||||
def __init__(self, client: MatrixClientHelper):
|
||||
self.client_helper = client
|
||||
|
@ -35,19 +34,19 @@ class MatrixBotCallbacks:
|
|||
if requestor_event.sender == self.client.user_id:
|
||||
return
|
||||
if msg == '!bots' or msg == '!matrixgpt':
|
||||
logger.debug(f'Message from {requestor_event.sender} in {room.room_id} --> "{msg}"')
|
||||
self.logger.debug(f'Message from {requestor_event.sender} in {room.room_id} --> "{msg}"')
|
||||
await sound_off(room, requestor_event, self.client_helper)
|
||||
return
|
||||
command_activated, sent_command_prefix, command_info = check_command_prefix(msg)
|
||||
|
||||
if not command_activated and is_thread(requestor_event):
|
||||
# Threaded messages
|
||||
logger.debug(f'Message from {requestor_event.sender} in {room.room_id} --> "{msg}"')
|
||||
self.logger.debug(f'Message from {requestor_event.sender} in {room.room_id} --> "{msg}"')
|
||||
# Start the task in the background and don't wait for it here or else we'll block everything.
|
||||
task = asyncio.create_task(do_reply_threaded_msg(self.client_helper, room, requestor_event))
|
||||
elif (command_activated or room.member_count == 2) and not is_thread(requestor_event):
|
||||
# Everything else
|
||||
logger.debug(f'Message from {requestor_event.sender} in {room.room_id} --> "{msg}"')
|
||||
self.logger.debug(f'Message from {requestor_event.sender} in {room.room_id} --> "{msg}"')
|
||||
allowed_to_chat = command_info.allowed_to_chat + global_config['allowed_to_chat']
|
||||
if not check_authorized(requestor_event.sender, allowed_to_chat):
|
||||
await self.client_helper.react_to_event(room.room_id, requestor_event.event_id, '🚫', extra_error='Not allowed to chat.' if global_config['send_extra_messages'] else None)
|
||||
|
@ -75,7 +74,7 @@ class MatrixBotCallbacks:
|
|||
"""
|
||||
await self.client.room_read_markers(room.room_id, event.event_id, event.event_id)
|
||||
if event.server_timestamp > self.startup_ts:
|
||||
logger.critical(f'Decryption failure for event {event.event_id} in room {room.room_id}')
|
||||
self.logger.critical(f'Decryption failure for event {event.event_id} in room {room.room_id}')
|
||||
await self.client_helper.react_to_event(room.room_id, event.event_id, "❌ 🔐")
|
||||
|
||||
async def unknown(self, room: MatrixRoom, event: UnknownEvent) -> None:
|
||||
|
|
Loading…
Reference in New Issue