diff options
author | Parker <contact@pkrm.dev> | 2024-05-18 20:06:51 -0500 |
---|---|---|
committer | Parker <contact@pkrm.dev> | 2024-05-18 20:06:51 -0500 |
commit | 32ab780b461c1c2b5e3e34c35b5902ed7006b95e (patch) | |
tree | b8717f5d5136b36c3d9bfe9e00346a7747003596 /code/cogs/error.py | |
parent | f0ec1c5a896744e4cdaa377a50b6277562a29f7f (diff) |
Create CordArr
Diffstat (limited to 'code/cogs/error.py')
-rw-r--r-- | code/cogs/error.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/code/cogs/error.py b/code/cogs/error.py new file mode 100644 index 0000000..2752400 --- /dev/null +++ b/code/cogs/error.py @@ -0,0 +1,27 @@ +import discord +from discord.ext import commands +from discord import app_commands + + +class slash_handlers(commands.Cog): + def __init__(self, bot): + self.bot = bot + bot.tree.on_error = self.on_error + + async def on_error(self, interaction: discord.Interaction, error): + if ( + isinstance(error, app_commands.CheckFailure) + and interaction.command.name == "newaccount" + ): + embed = discord.Embed( + title="Jellyfin Account Creation Disabled", + description=f"The owner of {self.bot.user.mention} has disabled the ability to create temporary Jellyfin accounts. Contact an administrator for more information.", + color=0xD01B86 + ) + await interaction.response.send_message(embed=embed, ephemeral=True) + else: + raise error + + +async def setup(bot: commands.Bot): + await bot.add_cog(slash_handlers(bot)) |