add sticky item support to add_item db helper function
@@ -164,13 +164,13 @@ class Database(commands.Cog):
async def mass_fetch_item(self, name):
return await self.db.fetch('SELECT * FROM items WHERE LOWER(name) = LOWER($1)', name)
- async def add_item(self, uid, name, sell_price, amount):
+ async def add_item(self, uid, name, sell_price, amount, sticky=False):
prev = await self.fetch_item(uid, name)
async with self.db.acquire() as con:
if prev is None:
- await con.execute('INSERT INTO items VALUES ($1, $2, $3, $4)',
- uid, name, sell_price, amount)
+ await con.execute('INSERT INTO items VALUES ($1, $2, $3, $4, $5)',
+ uid, name, sell_price, amount, sticky)
else:
await con.execute('UPDATE items SET amount = $1 WHERE uid = $2 AND LOWER(name) = LOWER($3)',
amount + prev['amount'], uid, name)
