mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 11:18:54 -05:00
Fix reason variable shadowing in [p]massban (#4575)
This commit is contained in:
parent
0089380bfd
commit
a7ec40664e
@ -462,14 +462,15 @@ class KickBanMixin(MixinMeta):
|
|||||||
# Call `ban_user()` method for all users that turned out to be guild members.
|
# Call `ban_user()` method for all users that turned out to be guild members.
|
||||||
for user_id, member in members.items():
|
for user_id, member in members.items():
|
||||||
try:
|
try:
|
||||||
success, reason = await self.ban_user(
|
# using `reason` here would shadow the reason passed to command
|
||||||
|
success, failure_reason = await self.ban_user(
|
||||||
user=member, ctx=ctx, days=days, reason=reason, create_modlog_case=True
|
user=member, ctx=ctx, days=days, reason=reason, create_modlog_case=True
|
||||||
)
|
)
|
||||||
if success:
|
if success:
|
||||||
banned.append(user_id)
|
banned.append(user_id)
|
||||||
else:
|
else:
|
||||||
errors[user_id] = _("Failed to ban user {user_id}: {reason}").format(
|
errors[user_id] = _("Failed to ban user {user_id}: {reason}").format(
|
||||||
user_id=user_id, reason=reason
|
user_id=user_id, reason=failure_reason
|
||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
errors[user_id] = _("Failed to ban user {user_id}: {reason}").format(
|
errors[user_id] = _("Failed to ban user {user_id}: {reason}").format(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user