mirror of
https://github.com/brandons209/Red-bot-Cogs.git
synced 2024-05-02 03:22:48 +12:00
add in dming context to warned users
This commit is contained in:
parent
f9a21d4d77
commit
ecfb1a1c33
|
@ -34,6 +34,7 @@ class Warnings_Custom(commands.Cog):
|
||||||
"reasons": {},
|
"reasons": {},
|
||||||
"allow_custom_reasons": False,
|
"allow_custom_reasons": False,
|
||||||
"allow_context": False,
|
"allow_context": False,
|
||||||
|
"allow_context_dm": False,
|
||||||
"toggle_dm": True,
|
"toggle_dm": True,
|
||||||
"show_mod": False,
|
"show_mod": False,
|
||||||
"warn_channel": None,
|
"warn_channel": None,
|
||||||
|
@ -136,6 +137,20 @@ class Warnings_Custom(commands.Cog):
|
||||||
else:
|
else:
|
||||||
await ctx.send(_("Context has been disabled."))
|
await ctx.send(_("Context has been disabled."))
|
||||||
|
|
||||||
|
@warningset.command()
|
||||||
|
@commands.guild_only()
|
||||||
|
async def allowcontextdm(self, ctx: commands.Context, allowed: bool):
|
||||||
|
"""Enable or disable sending context of warnings to warned user.
|
||||||
|
|
||||||
|
Send DM and Allow Context must also be enabled for this to take effect.
|
||||||
|
"""
|
||||||
|
guild = ctx.guild
|
||||||
|
await self.config.guild(guild).allow_context_dm.set(allowed)
|
||||||
|
if allowed:
|
||||||
|
await ctx.send(_("DMing context has been enabled."))
|
||||||
|
else:
|
||||||
|
await ctx.send(_("DMing context has been disabled."))
|
||||||
|
|
||||||
@warningset.command()
|
@warningset.command()
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
async def senddm(self, ctx: commands.Context, true_or_false: bool):
|
async def senddm(self, ctx: commands.Context, true_or_false: bool):
|
||||||
|
@ -481,6 +496,10 @@ class Warnings_Custom(commands.Cog):
|
||||||
description=reason_type["description"],
|
description=reason_type["description"],
|
||||||
)
|
)
|
||||||
em.add_field(name=_("Points"), value=str(reason_type["points"]))
|
em.add_field(name=_("Points"), value=str(reason_type["points"]))
|
||||||
|
|
||||||
|
if await self.config.guild(guild).allow_context_dm() and context != "":
|
||||||
|
em.add_field(name="Context", value=context)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
await user.send(
|
await user.send(
|
||||||
_("You have received a warning in {guild_name}.").format(guild_name=ctx.guild.name),
|
_("You have received a warning in {guild_name}.").format(guild_name=ctx.guild.name),
|
||||||
|
|
Loading…
Reference in a new issue