feat(invite): streamline invite handling and logging
Refactored the invite handling process within the invite callback for better consistency and maintainability. Swapped out a basic logging function with the bot's standardized logger for improved logging consistency across the application. Additionally, simplified the room joining process by removing redundant response handling, thus enhancing code readability and maintainability. These changes aim to unify the logging approach within the bot and ensure smoother invite processing without altering the underlying functionality.
This commit is contained in:
parent
28752ae3da
commit
8a253fdf90
1 changed files with 2 additions and 2 deletions
|
@ -2,9 +2,9 @@ from nio import InviteEvent, MatrixRoom
|
||||||
|
|
||||||
async def room_invite_callback(room: MatrixRoom, event: InviteEvent, bot):
|
async def room_invite_callback(room: MatrixRoom, event: InviteEvent, bot):
|
||||||
if room.room_id in bot.matrix_client.rooms:
|
if room.room_id in bot.matrix_client.rooms:
|
||||||
logging(f"Already in room {room.room_id} - ignoring invite")
|
bot.logger.log(f"Already in room {room.room_id} - ignoring invite")
|
||||||
return
|
return
|
||||||
|
|
||||||
bot.logger.log(f"Received invite to room {room.room_id} - joining...")
|
bot.logger.log(f"Received invite to room {room.room_id} - joining...")
|
||||||
|
|
||||||
response = await bot.matrix_client.join(room.room_id)
|
await bot.matrix_client.join(room.room_id)
|
Loading…
Reference in a new issue