mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 11:18:54 -05:00
[Warnings] Improve consistency in [p]warningset's commands (#4409)
* Be consistent with bool setters in warnings cog * black
This commit is contained in:
parent
343efba4d5
commit
980b5fa1c2
@ -126,12 +126,10 @@ class Warnings(commands.Cog):
|
|||||||
|
|
||||||
@warningset.command()
|
@warningset.command()
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
async def toggledm(self, ctx: commands.Context):
|
async def senddm(self, ctx: commands.Context, true_or_false: bool):
|
||||||
"""Toggle whether warnings should be sent to users in DMs."""
|
"""Set whether warnings should be sent to users in DMs."""
|
||||||
guild = ctx.guild
|
await self.config.guild(ctx.guild).toggle_dm.set(true_or_false)
|
||||||
toggle = not await self.config.guild(guild).toggle_dm()
|
if true_or_false:
|
||||||
await self.config.guild(guild).toggle_dm.set(toggle)
|
|
||||||
if toggle:
|
|
||||||
await ctx.send(_("I will now try to send warnings to users DMs."))
|
await ctx.send(_("I will now try to send warnings to users DMs."))
|
||||||
else:
|
else:
|
||||||
await ctx.send(_("Warnings will no longer be sent to users DMs."))
|
await ctx.send(_("Warnings will no longer be sent to users DMs."))
|
||||||
@ -173,15 +171,13 @@ class Warnings(commands.Cog):
|
|||||||
|
|
||||||
@warningset.command()
|
@warningset.command()
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
async def togglechannel(self, ctx: commands.Context):
|
async def usewarnchannel(self, ctx: commands.Context, true_or_false: bool):
|
||||||
"""
|
"""
|
||||||
Toggle if warnings should be sent to a channel set with `[p]warningset warnchannel`.
|
Set if warnings should be sent to a channel set with `[p]warningset warnchannel`.
|
||||||
"""
|
"""
|
||||||
guild = ctx.guild
|
await self.config.guild(ctx.guild).toggle_channel.set(true_or_false)
|
||||||
toggle = await self.config.guild(guild).toggle_channel()
|
channel = self.bot.get_channel(await self.config.guild(ctx.guild).warn_channel())
|
||||||
await self.config.guild(guild).toggle_channel.set(not toggle)
|
if true_or_false:
|
||||||
channel = self.bot.get_channel(await self.config.guild(guild).warn_channel())
|
|
||||||
if not toggle:
|
|
||||||
if channel:
|
if channel:
|
||||||
await ctx.send(
|
await ctx.send(
|
||||||
_("Warnings will now be sent to {channel}.").format(channel=channel.mention)
|
_("Warnings will now be sent to {channel}.").format(channel=channel.mention)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user