diff --git a/jarvis/cogs/admin/ban.py b/jarvis/cogs/admin/ban.py index 9b98ec9..c0c8050 100644 --- a/jarvis/cogs/admin/ban.py +++ b/jarvis/cogs/admin/ban.py @@ -302,13 +302,13 @@ class BanCog(ModcaseCog): @slash_option( name="active", description="Active bans", - opt_type=OptionTypes.INTEGER, + opt_type=OptionTypes.BOOLEAN, required=False, - choices=[SlashCommandChoice(name="Yes", value=1), SlashCommandChoice(name="No", value=0)], ) @check(admin_or_permissions(Permissions.BAN_MEMBERS)) - async def _bans_list(self, ctx: InteractionContext, btype: int = 0, active: int = 1) -> None: - active = bool(active) + async def _bans_list( + self, ctx: InteractionContext, btype: int = 0, active: bool = True + ) -> None: types = [0, "perm", "temp", "soft"] search = {"guild": ctx.guild.id} if active: diff --git a/jarvis/cogs/admin/warning.py b/jarvis/cogs/admin/warning.py index 0ef4d62..86b08aa 100644 --- a/jarvis/cogs/admin/warning.py +++ b/jarvis/cogs/admin/warning.py @@ -6,7 +6,6 @@ from dis_snek.models.discord.embed import EmbedField from dis_snek.models.discord.user import User from dis_snek.models.snek.application_commands import ( OptionTypes, - SlashCommandChoice, slash_command, slash_option, ) @@ -66,17 +65,11 @@ class WarningCog(ModcaseCog): @slash_option( name="active", description="View active only", - opt_type=OptionTypes.INTEGER, + opt_type=OptionTypes.BOOLEAN, required=False, - choices=[ - SlashCommandChoice(name="Yes", value=1), - SlashCommandChoice(name="No", value=0), - ], ) @check(admin_or_permissions(Permissions.MANAGE_GUILD)) - async def _warnings(self, ctx: InteractionContext, user: User, active: bool = 1) -> None: - active = bool(active) - + async def _warnings(self, ctx: InteractionContext, user: User, active: bool = True) -> None: warnings = ( await Warning.find( user=user.id, diff --git a/jarvis/cogs/remindme.py b/jarvis/cogs/remindme.py index 002964e..1b36042 100644 --- a/jarvis/cogs/remindme.py +++ b/jarvis/cogs/remindme.py @@ -13,7 +13,6 @@ from dis_snek.models.discord.embed import Embed, EmbedField from dis_snek.models.discord.modal import InputText, Modal, TextStyles from dis_snek.models.snek.application_commands import ( OptionTypes, - SlashCommandChoice, slash_command, slash_option, ) @@ -37,19 +36,14 @@ class RemindmeCog(Scale): @slash_option( name="private", description="Send as DM?", - opt_type=OptionTypes.STRING, + opt_type=OptionTypes.BOOLEAN, required=False, - choices=[ - SlashCommandChoice(name="Yes", value="y"), - SlashCommandChoice(name="No", value="n"), - ], ) async def _remindme( self, ctx: InteractionContext, - private: str = "n", + private: bool = False, ) -> None: - private = private == "y" modal = Modal( title="Set your reminder!", components=[ diff --git a/jarvis/cogs/settings.py b/jarvis/cogs/settings.py index de39409..fec3ee6 100644 --- a/jarvis/cogs/settings.py +++ b/jarvis/cogs/settings.py @@ -150,16 +150,16 @@ class SettingsCog(Scale): create_option( name="active", description="Active?", - opt_type=4, + opt_type=OptionTypes.BOOLEAN, required=True, ) ], ) @check(admin_or_permissions(manage_guild=True)) - async def _set_invitedel(self, ctx: SlashContext, active: int) -> None: + async def _set_invitedel(self, ctx: SlashContext, active: bool) -> None: await ctx.defer() - self.update_settings("noinvite", bool(active), ctx.guild.id) - await ctx.send(f"Settings applied. Automatic invite active: {bool(active)}") + self.update_settings("noinvite", active, ctx.guild.id) + await ctx.send(f"Settings applied. Automatic invite active: {active}") @cog_ext.cog_subcommand( base="settings", diff --git a/jarvis/cogs/twitter.py b/jarvis/cogs/twitter.py index 836b57b..79521a0 100644 --- a/jarvis/cogs/twitter.py +++ b/jarvis/cogs/twitter.py @@ -8,7 +8,6 @@ from dis_snek.models.discord.channel import GuildText from dis_snek.models.discord.components import ActionRow, Select, SelectOption from dis_snek.models.snek.application_commands import ( OptionTypes, - SlashCommandChoice, slash_command, slash_option, ) @@ -51,19 +50,14 @@ class TwitterCog(Scale): @slash_option( name="retweets", description="Mirror re-tweets?", - opt_type=OptionTypes.STRING, + opt_type=OptionTypes.BOOLEAN, required=False, - choices=[ - SlashCommandChoice(name="Yes", value="Yes"), - SlashCommandChoice(name="No", value="No"), - ], ) @check(admin_or_permissions(Permissions.MANAGE_GUILD)) async def _twitter_follow( - self, ctx: InteractionContext, handle: str, channel: GuildText, retweets: str = "Yes" + self, ctx: InteractionContext, handle: str, channel: GuildText, retweets: bool = True ) -> None: handle = handle.lower() - retweets = retweets == "Yes" if len(handle) > 15: await ctx.send("Invalid Twitter handle", ephemeral=True) return @@ -176,16 +170,11 @@ class TwitterCog(Scale): @slash_option( name="retweets", description="Mirror re-tweets?", - opt_type=OptionTypes.STRING, + opt_type=OptionTypes.BOOLEAN, required=False, - choices=[ - SlashCommandChoice(name="Yes", value="Yes"), - SlashCommandChoice(name="No", value="No"), - ], ) @check(admin_or_permissions(Permissions.MANAGE_GUILD)) - async def _twitter_modify(self, ctx: InteractionContext, retweets: str) -> None: - retweets = retweets == "Yes" + async def _twitter_modify(self, ctx: InteractionContext, retweets: bool = True) -> None: t = TwitterFollow.find(q(guild=ctx.guild.id)) twitters = [] async for twitter in t: