From 4c5173341ab8e3b9cd5ea7c5da928f9c00298903 Mon Sep 17 00:00:00 2001 From: Daniel Roschka Date: Wed, 6 Mar 2024 09:05:39 +0100 Subject: [PATCH] Improve responses of the moderation bot --- xpartamupp/modbot.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xpartamupp/modbot.py b/xpartamupp/modbot.py index 153b3f5..109ce41 100755 --- a/xpartamupp/modbot.py +++ b/xpartamupp/modbot.py @@ -436,7 +436,7 @@ async def mute_user(self, user: JID, duration: str, moderator: JID, reason: str) try: await self.plugin["xep_0045"].set_role(room, nick, "visitor", reason=reason) except IqError: - msg = f"Muting \"{nick}\" failed." + msg = f"Muting \"{nick}\" in {room} failed." logging.exception(msg) self.send_message(mto=self.command_room, mbody=msg, mtype="groupchat") @@ -504,7 +504,7 @@ async def unmute_user(self, user: JID, moderator: JID, reason: str) -> None: try: await self.plugin["xep_0045"].set_role(room, nick, "participant", reason=reason) except IqError: - msg = f"Unmuting \"{nick}\" failed." + msg = f"Unmuting \"{nick}\" in {room} failed." logging.exception(msg) self.send_message(mto=self.command_room, mbody=msg, mtype="groupchat") @@ -541,7 +541,7 @@ async def kick_user(self, user: JID, moderator: JID, reason: str) -> None: try: await self.plugin["xep_0045"].set_role(room, nick, "none", reason=reason) except IqError: - logging.exception("Kicking user %s failed", user) + logging.exception("Kicking \"%s\" from %s failed", user, room) rooms_kick_failed.append(room) continue @@ -554,7 +554,7 @@ async def kick_user(self, user: JID, moderator: JID, reason: str) -> None: mtype="groupchat") return - rooms_kicked_from_str = {", ".join([str(room.local) for room in rooms_kicked_from])} + rooms_kicked_from_str = ", ".join([str(room.local) for room in rooms_kicked_from]) self.send_message(mto=self.command_room, mbody=f"Kicked \"{user.node}\" from the following MUC rooms: " f"{rooms_kicked_from_str}",