Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 24 additions & 25 deletions redbot/core/core_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -1040,26 +1040,27 @@ async def embedset_showsettings(self, ctx: commands.Context):

@embedset.command(name="global")
@checks.is_owner()
async def embedset_global(self, ctx: commands.Context):
async def embedset_global(self, ctx: commands.Context, enabled: Optional[bool] = None):
"""
Toggle the global embed setting.
Set the global embed setting.

This is used as a fallback if the user
or guild hasn't set a preference. The
default is to use embeds.
"""
current = await self.bot._config.embeds()
await self.bot._config.embeds.set(not current)
if enabled is None:
enabled = not (await self.bot._config.embeds())
await self.bot._config.embeds.set(enabled)
await ctx.send(
_("Embeds are now {} by default.").format(_("disabled") if current else _("enabled"))
_("Embeds are now {} by default.").format(_("disabled") if enabled else _("enabled"))
)

@embedset.command(name="server", aliases=["guild"])
@checks.guildowner_or_permissions(administrator=True)
@commands.guild_only()
async def embedset_guild(self, ctx: commands.Context, enabled: bool = None):
async def embedset_guild(self, ctx: commands.Context, enabled: Optional[bool] = None):
"""
Toggle the guild's embed setting.
Set the guild's embed setting.

If enabled is None, the setting will be unset and
the global default will be used instead.
Expand All @@ -1082,9 +1083,9 @@ async def embedset_guild(self, ctx: commands.Context, enabled: bool = None):
@embedset.command(name="channel")
@checks.guildowner_or_permissions(administrator=True)
@commands.guild_only()
async def embedset_channel(self, ctx: commands.Context, enabled: bool = None):
async def embedset_channel(self, ctx: commands.Context, enabled: Optional[bool] = None):
"""
Toggle the channel's embed setting.
Set the channel's embed setting.

If enabled is None, the setting will be unset and
the guild default will be used instead.
Expand All @@ -1105,9 +1106,9 @@ async def embedset_channel(self, ctx: commands.Context, enabled: bool = None):
)

@embedset.command(name="user")
async def embedset_user(self, ctx: commands.Context, enabled: bool = None):
async def embedset_user(self, ctx: commands.Context, enabled: Optional[bool] = None):
"""
Toggle the user's embed setting for DMs.
Set the user's embed setting for DMs.

If enabled is None, the setting will be unset and
the global default will be used instead.
Expand Down Expand Up @@ -1722,33 +1723,31 @@ async def usebotcolour(self, ctx: commands.Context):
@_set.command()
@checks.guildowner()
@commands.guild_only()
async def serverfuzzy(self, ctx: commands.Context):
async def serverfuzzy(self, ctx: commands.Context, enabled: Optional[bool] = None):
"""
Toggle whether to enable fuzzy command search for the server.

Default is for fuzzy command search to be disabled.
Set whether to enable fuzzy command search for the server.
"""
current_setting = await ctx.bot._config.guild(ctx.guild).fuzzy()
await ctx.bot._config.guild(ctx.guild).fuzzy.set(not current_setting)
if enabled is None:
enabled = not (await ctx.bot._config.guild.fuzzy())
await ctx.bot._config.guild(ctx.guild).fuzzy.set(enabled)
await ctx.send(
_("Fuzzy command search has been {} for this server.").format(
_("disabled") if current_setting else _("enabled")
_("enabled") if enabled else _("disabled")
)
)

@_set.command()
@checks.is_owner()
async def fuzzy(self, ctx: commands.Context):
async def fuzzy(self, ctx: commands.Context, enabled: Optional[bool] = None):
"""
Toggle whether to enable fuzzy command search in DMs.

Default is for fuzzy command search to be disabled.
Set whether to enable fuzzy command search in DMs.
"""
current_setting = await ctx.bot._config.fuzzy()
await ctx.bot._config.fuzzy.set(not current_setting)
if enabled is None:
enabled = not (await ctx.bot._config.fuzzy())
await ctx.bot._config.fuzzy.set(enabled)
await ctx.send(
_("Fuzzy command search has been {} in DMs.").format(
_("disabled") if current_setting else _("enabled")
_("enabled") if enabled else _("disabled")
)
)

Expand Down