Skip to content

Commit

Permalink
Improve responses of the moderation bot
Browse files Browse the repository at this point in the history
  • Loading branch information
Dunedan committed Mar 6, 2024
1 parent ddacb09 commit 4c51733
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions xpartamupp/modbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down Expand Up @@ -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")

Expand Down Expand Up @@ -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

Expand All @@ -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}",
Expand Down

0 comments on commit 4c51733

Please sign in to comment.