add fetch_user_reminder_count() db helper function
@@ -54,9 +54,12 @@ class Database(commands.Cog):
for uid in uids:
self.uncache_user(uid)
- async def fetch_current_reminders(self):
+ async def fetch_current_reminders(self) -> list:
return await self.db.fetch("DELETE FROM reminders WHERE at >= $1 RETURNING *", arrow.utcnow().timestamp())
+ async def fetch_user_reminder_count(self, uid: int) -> int:
+ return await self.db.fetchval("SELECT COUNT(*) FROM reminders WHERE uid = $1", uid)
+
async def fetch_all_botbans(self):
botban_records = await self.db.fetch(
"SELECT uid FROM users WHERE bot_banned = true"
