M
M
marz1k2022-01-07 17:11:54
Python
marz1k, 2022-01-07 17:11:54

How to delay sending commands. Telebot?

randlist = [0.3, 0.6, 1]
        coin = random.choice(randlist)
        cur.execute(f"SELECT balance from users where id = {message.chat.id}")
        con.commit()
        data = tuple(cur.fetchone())
        balance = round(data[0] + coin, 2)
        text = f"""
Вы заработали {coin} Robux!
Ваш баланс: {balance}✅
        """
        if message.text == "Заработать":
            cur.execute(f"UPDATE users SET balance = balance + {coin} WHERE id = {message.chat.id}" )
            bot.send_message(message.chat.id, text , reply_markup=keyboard)


Attention. Possible trigger due to shit code!

It is necessary that when spamming, the "Earn" command would be sent to the person: "Wait N seconds" I tried to implement it through the database, but I did not succeed at all.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question