add helper for toggling user settings
This commit is contained in:
parent
3fed160303
commit
07b4679238
1 changed files with 7 additions and 0 deletions
|
@ -89,6 +89,13 @@ class Nomen(Bot):
|
|||
await super().close()
|
||||
await self.db.close()
|
||||
|
||||
async def user_toggle(self, user_id, item):
|
||||
await self.db.execute(
|
||||
"REPLACE INTO users (user_id, {item}) VALUES(:user_id, iff((SELECT {item} FROM users WHERE user_id=:user_id)), 0, 1)",
|
||||
{"user_id": user_id},
|
||||
)
|
||||
await self.db.commit()
|
||||
|
||||
|
||||
bot = Nomen(
|
||||
description="Keeper of Names",
|
||||
|
|
Loading…
Reference in a new issue