From 92069ffda5f1866f597d678593f377754d0e14e4 Mon Sep 17 00:00:00 2001 From: suhas Date: Thu, 16 Nov 2023 23:25:18 -0600 Subject: finally fixed db issues i think --- cogs/stats.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'cogs/stats.py') diff --git a/cogs/stats.py b/cogs/stats.py index 03031ec..071d8d5 100644 --- a/cogs/stats.py +++ b/cogs/stats.py @@ -2,7 +2,8 @@ from discord.ext.commands import Cog, Bot from discord.app_commands import command from discord import Interaction, Embed, Color from prisma import Prisma -from prisma.models import User, CategoryBreakdown +# from prisma.models import User, CategoryBreakdown +# from prisma import get_client from common.types import category_field_translations reverse_categories = {v: k for k, v in category_field_translations.items()} @@ -14,10 +15,11 @@ class Stats(Cog): @command(description="Get your statistics for qbb") async def stats(self, ctx: Interaction): - db = Prisma(auto_register=True) + db = Prisma() + # db = get_client() await db.connect() - stats = await User.prisma().find_first(where={'id': ctx.user.id}) - cb = await CategoryBreakdown.prisma().find_first(where={'userId': ctx.user.id}) + stats = await db.user.find_first(where={'id': ctx.user.id}) + cb = await db.categorybreakdown.find_first(where={'userId': ctx.user.id}) if stats is None or cb is None: embed = Embed(title="No Stats!", description="You have no stats! Trying using the bot and then running this command", color=Color.red()) return await ctx.response.send_message(embed=embed) -- cgit 1.4.1-2-gfad0