add db helper function set_cmd_usable
@@ -103,6 +103,13 @@ class Database(commands.Cog):
async def fetch_guild_premium(self, gid):
return bool(await self.db.fetchval('SELECT premium FROM guilds WHERE gid = $1', gid))
+ async def set_cmd_usable(self, gid, cmd, usable):
+ async with self.db.acquire() as con:
+ if usable:
+ await con.execute('INSERT INTO disabled VALUES ($1, $2)', gid, cmd)
+ else:
+ await con.execute('DELETE FROM disabled WHERE gid = $1 AND cmd = $2')
+
async def fetch_user(self, uid):
user = await self.db.fetchrow('SELECT * FROM users WHERE uid = $1', uid)
