Skip to content

Commit 1a5802c

Browse files
committed
SNIPPET: Change queries to match the new db schemas.
1 parent 70a5dd1 commit 1a5802c

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

bot/cogs/snippets.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ async def snippet(self, ctx: GuildContext, *, name: str):
3737
async def remove(self, ctx: GuildContext, name: str):
3838
query = """
3939
DELETE FROM snippets
40-
WHERE guild_id = $1 AND name = $2
41-
RETURNING name
40+
WHERE name = $2
41+
RETURNING id
4242
"""
4343
result = await self.pool.fetchrow(query, ctx.guild.id, name)
4444
if result is None:
@@ -79,9 +79,9 @@ async def snippets_list(
7979
async def show(self, ctx: GuildContext, name: str):
8080
query = """
8181
SELECT content FROM snippets
82-
WHERE guild_id = $1 AND name = $2
82+
WHERE name = $1
8383
"""
84-
data = await self.pool.fetchrow(query, ctx.guild.id, name)
84+
data = await self.pool.fetchrow(query, name)
8585
if data is None:
8686
ret_embed = discord.Embed(
8787
title="Oops...",
@@ -107,12 +107,12 @@ async def edit(self, ctx: GuildContext, name: str, content: Optional[str]):
107107
return
108108
query = """
109109
UPDATE snippets
110-
SET content = $3
111-
WHERE guild_id = $1 AND name = $2
110+
SET content = $2
111+
WHERE name = $1
112112
RETURNING name
113113
"""
114114

115-
result = await self.pool.fetchrow(query, ctx.guild.id, name, content)
115+
result = await self.pool.fetchrow(query, name, content)
116116
if result is None:
117117
await ctx.reply(
118118
embed=discord.Embed(

0 commit comments

Comments
 (0)