mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 03:08:55 -05:00
[Warnings] Help users understand custom reasons (#2049)
Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
This commit is contained in:
parent
e126cf9f4e
commit
c0c5535005
@ -221,8 +221,8 @@ class Warnings:
|
|||||||
if user == ctx.author:
|
if user == ctx.author:
|
||||||
await ctx.send(_("You cannot warn yourself."))
|
await ctx.send(_("You cannot warn yourself."))
|
||||||
return
|
return
|
||||||
if reason.lower() == "custom":
|
|
||||||
custom_allowed = await self.config.guild(ctx.guild).allow_custom_reasons()
|
custom_allowed = await self.config.guild(ctx.guild).allow_custom_reasons()
|
||||||
|
if reason.lower() == "custom":
|
||||||
if not custom_allowed:
|
if not custom_allowed:
|
||||||
await ctx.send(
|
await ctx.send(
|
||||||
_(
|
_(
|
||||||
@ -236,7 +236,21 @@ class Warnings:
|
|||||||
guild_settings = self.config.guild(ctx.guild)
|
guild_settings = self.config.guild(ctx.guild)
|
||||||
async with guild_settings.reasons() as registered_reasons:
|
async with guild_settings.reasons() as registered_reasons:
|
||||||
if reason.lower() not in registered_reasons:
|
if reason.lower() not in registered_reasons:
|
||||||
await ctx.send(_("That is not a registered reason!"))
|
msg = _("That is not a registered reason!")
|
||||||
|
if custom_allowed:
|
||||||
|
msg += " " + _(
|
||||||
|
"Do `{prefix}warn {user} custom` to specify a custom reason."
|
||||||
|
).format(prefix=ctx.prefix, user=ctx.author)
|
||||||
|
elif (
|
||||||
|
ctx.guild.owner == ctx.author
|
||||||
|
or ctx.channel.permissions_for(ctx.author).administrator
|
||||||
|
or await ctx.bot.is_owner(ctx.author)
|
||||||
|
):
|
||||||
|
msg += " " + _(
|
||||||
|
"Do `{prefix}warningset allowcustomreasons true` to enable custom "
|
||||||
|
"reasons."
|
||||||
|
).format(prefix=ctx.prefix)
|
||||||
|
await ctx.send(msg)
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
reason_type = registered_reasons[reason.lower()]
|
reason_type = registered_reasons[reason.lower()]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user