diff --git a/nomen/main.py b/nomen/main.py index cd480bc..548daa1 100644 --- a/nomen/main.py +++ b/nomen/main.py @@ -90,11 +90,11 @@ 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}, - ) + async def get_setting(self, user_id, setting): + return await self.db.fetch_singleton(f"SELECT {setting} FROM users WHERE user_id=?", (user_id,)) + + async def set_setting(self, user_id, setting, value: bool): + await self.db.execute(f"REPLACE INTO users (user_id, {setting}) VALUES(?, ?)", (user_id, value)) await self.db.commit()