@@ -40,21 +40,11 @@ async def initialize_async(self):
4040 router .observe_chat_init (lambda room_id , ychat : self .on_chat_init (router , room_id ))
4141
4242 def on_chat_init (self , router : MessageRouter , room_id : str ):
43- router .observe_slash_cmd_msg (room_id , self .on_slash_command )
43+ router .observe_slash_cmd_msg (room_id , "refresh-personas" , self .on_slash_command )
4444 self .log .info ("Attached router observer." )
4545
46- def on_slash_command (self , room_id : str , message : Message ):
47- first_word = get_first_word (message .body )
48- assert first_word and first_word .startswith ("/" )
49-
50- command_id = first_word [1 :]
51- if command_id == "refresh-personas" :
52- self .event_loop .create_task (self .handle_refresh_personas (room_id ))
53- return True
54-
55- # If command is unrecognized, log an error
56- self .log .warning (f"Unrecognized slash command: '/{ command_id } '" )
57- return False
46+ def on_slash_command (self , room_id : str , command : str , message : Message ):
47+ self .event_loop .create_task (self .handle_refresh_personas (room_id ))
5848
5949 async def handle_refresh_personas (self , room_id : str ):
6050 self .log .info (f"Received /refresh-personas in room '{ room_id } '." )
0 commit comments