mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-12-06 09:22:31 -05:00
* [Mod] Send ban reason on Temp Bans
* If none
* Locale friendly
* Fixes for black style
* Use double line break to distinguish between reason header
* Check settings
* Black
* Reduce the number of config calls
* remove additional config call
* fixes
* style
* We're already in `if reason` so this is always True
(cherry picked from commit 4e2e4bfe6a)
Co-authored-by: Kreus Amredes <67752638+Kreusada@users.noreply.github.com>
Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
Co-authored-by: Kreus Amredes <67752638+Kreusada@users.noreply.github.com>
Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
This commit is contained in:
@@ -620,12 +620,14 @@ class KickBanMixin(MixinMeta):
|
|||||||
await ctx.send(_("I cannot do that due to Discord hierarchy rules."))
|
await ctx.send(_("I cannot do that due to Discord hierarchy rules."))
|
||||||
return
|
return
|
||||||
|
|
||||||
|
guild_data = await self.config.guild(guild).all()
|
||||||
|
|
||||||
if duration is None:
|
if duration is None:
|
||||||
duration = timedelta(seconds=await self.config.guild(guild).default_tempban_duration())
|
duration = timedelta(seconds=guild_data["default_tempban_duration"])
|
||||||
unban_time = datetime.now(timezone.utc) + duration
|
unban_time = datetime.now(timezone.utc) + duration
|
||||||
|
|
||||||
if days is None:
|
if days is None:
|
||||||
days = await self.config.guild(guild).default_days()
|
days = guild_data["default_days"]
|
||||||
|
|
||||||
if not (0 <= days <= 7):
|
if not (0 <= days <= 7):
|
||||||
await ctx.send(_("Invalid days. Must be between 0 and 7."))
|
await ctx.send(_("Invalid days. Must be between 0 and 7."))
|
||||||
@@ -643,8 +645,10 @@ class KickBanMixin(MixinMeta):
|
|||||||
msg = _("You have been temporarily banned from {server_name} until {date}.").format(
|
msg = _("You have been temporarily banned from {server_name} until {date}.").format(
|
||||||
server_name=guild.name, date=unban_time.strftime("%m-%d-%Y %H:%M:%S")
|
server_name=guild.name, date=unban_time.strftime("%m-%d-%Y %H:%M:%S")
|
||||||
)
|
)
|
||||||
|
if guild_data["dm_on_kickban"] and reason:
|
||||||
|
msg += _("\n\n**Reason:** {reason}").format(reason=reason)
|
||||||
if invite:
|
if invite:
|
||||||
msg += _(" Here is an invite for when your ban expires: {invite_link}").format(
|
msg += _("\n\nHere is an invite for when your ban expires: {invite_link}").format(
|
||||||
invite_link=invite
|
invite_link=invite
|
||||||
)
|
)
|
||||||
await member.send(msg)
|
await member.send(msg)
|
||||||
|
|||||||
Reference in New Issue
Block a user