D
D
Dream2021-06-26 12:48:16
Python
Dream, 2021-06-26 12:48:16

How to check a user's post against the first post?

I want to make achievements in the bot using the database, how to make achievements related to the number of messages on the server? 1 achievement - "Pioneer" to be given for the first message on the server. And other achievements for a certain number of messages on the server (50, 100, 1000, etc.). How can this be implemented? (working with kogami)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
TanderOFF, 2021-06-26
@dreameddd

If you work with sqlite3 then add to
on_message:

id_author = message.author.id
cursor.execute("UPDATE users SET msg = msg + {} WHERE id = {}".format(1, id_author))
connection.commit()
    if cursor.execute("SELECT msg FROM users WHERE id = {}".format(id_author)).fetchone()[0] == 1000:
        #сюда вставь отправку сообщения по типу "Воу ты написал 1000 сообщений
    if cursor.execute("SELECT msg FROM users WHERE id = {}".format(id_author)).fetchone()[0] == 5000:
        #сюда вставь отправку сообщения по типу "Воу ты написал 5000 сообщений

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question