changes to !!cleandb command
@@ -338,12 +338,10 @@ Latency: {round(self.bot.latency*1000, 2)} ms
@commands.command(name="cleandb")
@commands.is_owner()
async def clean_db(self, ctx):
- c = 0
for record in await self.bot.db.fetch("SELECT * FROM currency"):
async with self.bot.db.acquire() as con:
- if self.bot.get_user(record[0]) is None:
- c += 1
- await con.execute("DELETE FROM currency WHERE currency.id=$1", record[0])
+ if not self.bot.get_user(record[0]):
+ await con.execute(f"DELETE FROM currency WHERE currency.id=$1", record[0])
await ctx.send(f"Cleaned up {c} entries.")
