aboutsummaryrefslogtreecommitdiff
path: root/code
diff options
context:
space:
mode:
authorParker <contact@pkrm.dev>2024-07-10 16:31:29 -0500
committerParker <contact@pkrm.dev>2024-07-10 16:31:29 -0500
commit8ffb0703477b1e3ea49f9e354cc1753b95fc0e75 (patch)
tree11bcbecde4f03ca33d3a144ad87e7dfb97600f64 /code
parentb31573a1ef5c791fd5aad97019b02afc4a92fb67 (diff)
Properly subclass `CommandTree` for errors
Diffstat (limited to 'code')
-rw-r--r--code/tree.py (renamed from code/cogs/slash_handlers.py)19
1 files changed, 4 insertions, 15 deletions
diff --git a/code/cogs/slash_handlers.py b/code/tree.py
index 019ee45..0ac8fe8 100644
--- a/code/cogs/slash_handlers.py
+++ b/code/tree.py
@@ -1,5 +1,4 @@
import discord
-from discord.ext import commands
from discord import app_commands
from discord.ext.commands.errors import *
import datetime
@@ -9,12 +8,10 @@ from config import BOT_COLOR
from custom_source import LoadError
-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):
+class Tree(app_commands.CommandTree):
+ async def on_error(
+ self, interaction: discord.Interaction, error: app_commands.AppCommandError
+ ):
music_commands = [
"play",
"clear",
@@ -83,11 +80,3 @@ class slash_handlers(commands.Cog):
else:
raise error
-
- @commands.Cog.listener()
- async def on_command_error(self, ctx, error):
- return
-
-
-async def setup(bot: commands.Bot):
- await bot.add_cog(slash_handlers(bot))