@commands.command(
name="daily",
aliases=["24hr"]
)
async def user_daily(self, ctx):
place_datetime = datetime.datetime.now()
local_collection = collection['coins']
data = local_collection.find_one({'id': ctx.author.id})
balance = local_collection.find_one({"_id": ctx.author.id})["balance"]
if not data:
data = {}
data['datetime'] = data.get('datetime', place_datetime - datetime.timedelta(days=1, seconds=60))
if (place_datetime - data['datetime']).days < 1:
await ctx.send(
f"You can only collect the reward once every 1 day! Come via `{int((place_datetime - data['datetime']).seconds / 3600)}` hours")
else:
local_collection.update_one({'id': ctx.author.id},
{'$inc': {'balance': balance + 50}, '$set': {'datetime': place_datetime}})
await ctx.send(f"You took 50 coins! Come back in a day and pick up more!")
i made this cmd with cooldown, and i want put cooldown in mongo db, since i always restart my bot, but this dodenst work - i meam nothing put in db and also "balance" doesnt change, help me please

just realized I don't have a unique index to use



