mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-12-06 01:12:33 -05:00
d.py 2.3 / pomelo changes (#6130)
Co-authored-by: Michael Oliveira <34169552+Flame442@users.noreply.github.com>
This commit is contained in:
@@ -177,21 +177,23 @@ class KickBanMixin(MixinMeta):
|
||||
|
||||
if removed_temp:
|
||||
log.info(
|
||||
"{}({}) upgraded the tempban for {} to a permaban.".format(
|
||||
author.name, author.id, user.id
|
||||
)
|
||||
"%s (%s) upgraded the tempban for %s to a permaban.", author, author.id, user.id
|
||||
)
|
||||
success_message = _(
|
||||
"User with ID {user_id} was upgraded from a temporary to a permanent ban."
|
||||
).format(user_id=user.id)
|
||||
else:
|
||||
username = user.name if hasattr(user, "name") else "Unknown"
|
||||
user_handle = str(user) if isinstance(user, discord.abc.User) else "Unknown"
|
||||
try:
|
||||
await guild.ban(user, reason=audit_reason, delete_message_seconds=days * 86400)
|
||||
log.info(
|
||||
"{}({}) {}ned {}({}), deleting {} days worth of messages.".format(
|
||||
author.name, author.id, ban_type, username, user.id, str(days)
|
||||
)
|
||||
"%s (%s) %sned %s (%s), deleting %s days worth of messages.",
|
||||
author,
|
||||
author.id,
|
||||
ban_type,
|
||||
user_handle,
|
||||
user.id,
|
||||
days,
|
||||
)
|
||||
success_message = _("Done. That felt good.")
|
||||
except discord.Forbidden:
|
||||
@@ -200,9 +202,12 @@ class KickBanMixin(MixinMeta):
|
||||
return False, _("User with ID {user_id} not found").format(user_id=user.id)
|
||||
except Exception:
|
||||
log.exception(
|
||||
"{}({}) attempted to {} {}({}), but an error occurred.".format(
|
||||
author.name, author.id, ban_type, username, user.id
|
||||
)
|
||||
"%s (%s) attempted to %s %s (%s), but an error occurred.",
|
||||
author,
|
||||
author.id,
|
||||
ban_type,
|
||||
user_handle,
|
||||
user.id,
|
||||
)
|
||||
return False, _("An unexpected error occurred.")
|
||||
|
||||
@@ -333,14 +338,16 @@ class KickBanMixin(MixinMeta):
|
||||
await member.send(embed=em)
|
||||
try:
|
||||
await guild.kick(member, reason=audit_reason)
|
||||
log.info("{}({}) kicked {}({})".format(author.name, author.id, member.name, member.id))
|
||||
log.info("%s (%s) kicked %s (%s)", author, author.id, member, member.id)
|
||||
except discord.errors.Forbidden:
|
||||
await ctx.send(_("I'm not allowed to do that."))
|
||||
except Exception:
|
||||
log.exception(
|
||||
"{}({}) attempted to kick {}({}), but an error occurred.".format(
|
||||
author.name, author.id, member.name, member.id
|
||||
)
|
||||
"%s (%s) attempted to kick %s (%s), but an error occurred.",
|
||||
author,
|
||||
author.id,
|
||||
member,
|
||||
member.id,
|
||||
)
|
||||
else:
|
||||
await modlog.create_case(
|
||||
@@ -531,9 +538,10 @@ class KickBanMixin(MixinMeta):
|
||||
tempbans.remove(user_id)
|
||||
upgrades.append(str(user_id))
|
||||
log.info(
|
||||
"{}({}) upgraded the tempban for {} to a permaban.".format(
|
||||
author.name, author.id, user_id
|
||||
)
|
||||
"%s (%s) upgraded the tempban for %s to a permaban.",
|
||||
author,
|
||||
author.id,
|
||||
user_id,
|
||||
)
|
||||
banned.append(user_id)
|
||||
else:
|
||||
@@ -541,7 +549,7 @@ class KickBanMixin(MixinMeta):
|
||||
await guild.ban(
|
||||
user, reason=audit_reason, delete_message_seconds=days * 86400
|
||||
)
|
||||
log.info("{}({}) hackbanned {}".format(author.name, author.id, user_id))
|
||||
log.info("%s (%s) hackbanned %s", author, author.id, user_id)
|
||||
except discord.NotFound:
|
||||
errors[user_id] = _("User with ID {user_id} not found").format(
|
||||
user_id=user_id
|
||||
@@ -716,24 +724,32 @@ class KickBanMixin(MixinMeta):
|
||||
return
|
||||
except discord.HTTPException:
|
||||
log.exception(
|
||||
"{}({}) attempted to softban {}({}), but an error occurred trying to ban them.".format(
|
||||
author.name, author.id, member.name, member.id
|
||||
)
|
||||
"%s (%s) attempted to softban %s (%s), but an error occurred trying to ban them.",
|
||||
author,
|
||||
author.id,
|
||||
member,
|
||||
member.id,
|
||||
)
|
||||
return
|
||||
try:
|
||||
await guild.unban(member)
|
||||
except discord.HTTPException:
|
||||
log.exception(
|
||||
"{}({}) attempted to softban {}({}), but an error occurred trying to unban them.".format(
|
||||
author.name, author.id, member.name, member.id
|
||||
)
|
||||
"%s (%s) attempted to softban %s (%s),"
|
||||
" but an error occurred trying to unban them.",
|
||||
author,
|
||||
author.id,
|
||||
member,
|
||||
member.id,
|
||||
)
|
||||
return
|
||||
else:
|
||||
log.info(
|
||||
"{}({}) softbanned {}({}), deleting 1 day worth "
|
||||
"of messages.".format(author.name, author.id, member.name, member.id)
|
||||
"%s (%s) softbanned %s (%s), deleting 1 day worth of messages.",
|
||||
author,
|
||||
author.id,
|
||||
member,
|
||||
member.id,
|
||||
)
|
||||
await modlog.create_case(
|
||||
self.bot,
|
||||
|
||||
Reference in New Issue
Block a user