Skip to content

Commit

Permalink
Read mod_reason entry only if reason is None
Browse files Browse the repository at this point in the history
  • Loading branch information
kevin1015wang committed Nov 23, 2024
1 parent cfbd401 commit 7948058
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions redbot/cogs/mod/kickban.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ async def ban_user(

removed_temp = False

if await self.config.guild(guild).mod_reason():
if reason is None:
if reason is None:
if await self.config.guild(guild).mod_reason():
return False, _("You must provide a reason for the ban.")

if not (0 <= days <= 7):
Expand Down Expand Up @@ -307,8 +307,8 @@ async def kick(self, ctx: commands.Context, member: discord.Member, *, reason: s
author = ctx.author
guild = ctx.guild

if await self.config.guild(guild).mod_reason():
if reason is None:
if reason is None:
if await self.config.guild(guild).mod_reason():
await ctx.send(_("You must provide a reason for the kick."))
return

Expand Down Expand Up @@ -437,8 +437,8 @@ async def massban(
errors = {}
upgrades = []

if await self.config.guild(ctx.guild).mod_reason():
if reason is None:
if reason is None:
if await self.config.guild(ctx.guild).mod_reason():
await ctx.send(_("You must provide a reason for the massban."))
return

Expand Down Expand Up @@ -619,8 +619,8 @@ async def tempban(
guild = ctx.guild
author = ctx.author

if await self.config.guild(guild).mod_reason():
if reason is None:
if reason is None:
if await self.config.guild(guild).mod_reason():
await ctx.send(_("You must provide a reason for the tempban."))
return

Expand Down Expand Up @@ -703,8 +703,8 @@ async def softban(self, ctx: commands.Context, member: discord.Member, *, reason
guild = ctx.guild
author = ctx.author

if await self.config.guild(guild).mod_reason():
if reason is None:
if reason is None:
if await self.config.guild(guild).mod_reason():
await ctx.send(_("You must provide a reason for the softban."))
return

Expand Down Expand Up @@ -795,8 +795,8 @@ async def voicekick(
self, ctx: commands.Context, member: discord.Member, *, reason: str = None
):
"""Kick a member from a voice channel."""
if await self.config.guild(ctx.guild).mod_reason():
if reason is None:
if reason is None:
if await self.config.guild(ctx.guild).mod_reason():
await ctx.send(_("You must provide a reason for the voicekick."))
return

Expand Down Expand Up @@ -847,8 +847,8 @@ async def voiceunban(
self, ctx: commands.Context, member: discord.Member, *, reason: str = None
):
"""Unban a user from speaking and listening in the server's voice channels."""
if await self.config.guild(ctx.guild).mod_reason():
if reason is None:
if reason is None:
if await self.config.guild(ctx.guild).mod_reason():
await ctx.send(_("You must provide a reason for the voiceunban."))
return

Expand Down Expand Up @@ -893,8 +893,8 @@ async def voiceunban(
@commands.admin_or_permissions(mute_members=True, deafen_members=True)
async def voiceban(self, ctx: commands.Context, member: discord.Member, *, reason: str = None):
"""Ban a user from speaking and listening in the server's voice channels."""
if await self.config.guild(ctx.guild).mod_reason():
if reason is None:
if reason is None:
if await self.config.guild(ctx.guild).mod_reason():
await ctx.send(_("You must provide a reason for the voiceban."))
return

Expand Down Expand Up @@ -947,8 +947,8 @@ async def unban(
1. Copy it from the mod log case (if one was created), or
2. Enable Developer Mode, go to Bans in this server's settings, right-click the user and select 'Copy ID'.
"""
if await self.config.guild(ctx.guild).mod_reason():
if reason is None:
if reason is None:
if await self.config.guild(ctx.guild).mod_reason():
await ctx.send(_("You must provide a reason for the unban."))
return

Expand Down

0 comments on commit 7948058

Please sign in to comment.