aboutsummaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
authorParker <contact@pkrm.dev>2025-04-02 18:52:00 -0500
committerParker <contact@pkrm.dev>2025-04-02 18:52:00 -0500
commitb5099937f84e2fb58b69d97b4b8fff17363fe7d9 (patch)
treece0626d12ad3daf9bf2b7c103914bf7411ea245e /src/utils
parentae1ac1d731813008682ccba70db0f228b15a72e3 (diff)
First commit. Lots of stuff
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/command_tree.py19
-rw-r--r--src/utils/db.py9
2 files changed, 28 insertions, 0 deletions
diff --git a/src/utils/command_tree.py b/src/utils/command_tree.py
new file mode 100644
index 0000000..31ec2c1
--- /dev/null
+++ b/src/utils/command_tree.py
@@ -0,0 +1,19 @@
+import discord
+from discord import app_commands
+from discord.ext.commands.errors import *
+
+from config import create_embed
+
+
+class Tree(app_commands.CommandTree):
+ async def on_error(
+ self,
+ interaction: discord.Interaction,
+ error: app_commands.AppCommandError,
+ ):
+
+ if isinstance(error, CommandNotFound):
+ return
+
+ else:
+ raise error
diff --git a/src/utils/db.py b/src/utils/db.py
new file mode 100644
index 0000000..a6734ea
--- /dev/null
+++ b/src/utils/db.py
@@ -0,0 +1,9 @@
+from database import SessionLocal
+
+
+def get_db():
+ db = SessionLocal()
+ try:
+ yield db
+ finally:
+ db.close()