Skip to content

Commit

Permalink
SNIPPET: Change queries to match the new db schemas.
Browse files Browse the repository at this point in the history
  • Loading branch information
jamievlin committed Jul 13, 2024
1 parent 70a5dd1 commit 1a5802c
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions bot/cogs/snippets.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ async def snippet(self, ctx: GuildContext, *, name: str):
async def remove(self, ctx: GuildContext, name: str):
query = """
DELETE FROM snippets
WHERE guild_id = $1 AND name = $2
RETURNING name
WHERE name = $2
RETURNING id
"""
result = await self.pool.fetchrow(query, ctx.guild.id, name)
if result is None:
Expand Down Expand Up @@ -79,9 +79,9 @@ async def snippets_list(
async def show(self, ctx: GuildContext, name: str):
query = """
SELECT content FROM snippets
WHERE guild_id = $1 AND name = $2
WHERE name = $1
"""
data = await self.pool.fetchrow(query, ctx.guild.id, name)
data = await self.pool.fetchrow(query, name)
if data is None:
ret_embed = discord.Embed(
title="Oops...",
Expand All @@ -107,12 +107,12 @@ async def edit(self, ctx: GuildContext, name: str, content: Optional[str]):
return
query = """
UPDATE snippets
SET content = $3
WHERE guild_id = $1 AND name = $2
SET content = $2
WHERE name = $1
RETURNING name
"""

result = await self.pool.fetchrow(query, ctx.guild.id, name, content)
result = await self.pool.fetchrow(query, name, content)
if result is None:
await ctx.reply(
embed=discord.Embed(
Expand Down

0 comments on commit 1a5802c

Please sign in to comment.