SQLite Setup

This commit is contained in:
Soenke committed 2026-05-29 18:18:26 +02:00
1 parent 7882ba4915
commit d564756511
5 files changed
+64 -10

No files matched your search

+2 -2
View File
@@ -222,7 +222,7 @@ class CountryDropdownView(discord.ui.View):
class MainInteractiveMenu(discord.ui.View):
def __init__(self):
super().__init__()
super().__init__(timeout=None)
@discord.ui.button(label="Register a Meetup", style=discord.ButtonStyle.success)
async def primary_button_callback(self, interaction: discord.Interaction, button: discord.ui.Button):
@@ -246,7 +246,7 @@ class CreateMeetup(commands.Cog):
async def startup(self):
await self.bot.wait_until_ready()
channel = await self.bot.fetch_channel(os.getenv('CREATE_MEETUP_CHANNEL_ID'))
channel = await self.bot.fetch_channel(os.getenv("CREATE_MEETUP_CHANNEL_ID"))
await channel.purge(limit=None, bulk=True)
+29
View File
@@ -0,0 +1,29 @@
import discord
from discord.ext import commands
from discord import app_commands
class DBTest(commands.Cog):
def __init__(self, bot: commands.Bot):
self.bot = bot
@app_commands.command(name="test_db", description="Tests the database connection")
async def test_db(self, interaction: discord.Interaction):
await interaction.response.defer(ephemeral=True)
try:
db_conn = self.bot.database.conn
async with db_conn.execute("SELECT 1;") as cursor:
result = await cursor.fetchone()
if result:
await interaction.followup.send("Database connection successful!")
else:
await interaction.followup.send("Database responded, but returned no data.")
except Exception as e:
await interaction.followup.send(f"Database connection failed: {e}")
async def setup(bot: commands.Bot):
await bot.add_cog(DBTest(bot))