T
T
Telmor2021-10-15 21:36:22
Python
Telmor, 2021-10-15 21:36:22

How to make a cooldown per team in discord.py?

I have my code:

@commands.command(
        aliases=['награда']
    )
    async def timely(self,ctx):
        abalance = self.collection.find_one({"_id": ctx.author.id})["balance"]
        self.collection.update_one({"_id": ctx.author.id},
            {"$set": {"balance": abalance + 30}})

        emb = discord.Embed(
            title='Временная награда',
            description=f'__{ctx.author.mention}__, вы получили свои 30 осколков!\n Приходите через 12 часов.'
        )
        emb.set_thumbnail(url=ctx.author.avatar_url)
        await ctx.send(embed=emb)

(PS I use pymongo)
And I would like to cd 12 hours on it. And if the user writes it earlier, then he was given an error and wrote how much was left before receiving the reward.
(I know how to make a crutch, but I want to do it normally and adequately).
I ask for proper help.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
soremix, 2021-10-15
@SoreMix

Many times discussed
https://qna.habr.com/q/985253

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question