#Error

1 messages · Page 1 of 1 (latest)

errant heron
#

The bot adds only itself to the database, but not me

Code:

@bot.event
async def on_ready():
    cursor.execute("""CREATE TABLE IF NOT EXISTS users (
        name TEXT,
        id BIGINT,
        wins BIGINT,
        fails BIGINT
        )""")

    for guild in bot.guilds:
        for member in guild.members:
            if cursor.execute(f"SELECT id FROM users WHERE id = {member.id}").fetchone() is None:
                cursor.execute(f"INSERT INTO users VALUES('{member}', {member.id}, 0, 0)")
            else:
                continue

    connection.commit()
    print("Бот зашёл")
split vault
#

You need member intents

errant heron
errant heron
# split vault You need member intents

I did it a little differently, but keep in mind -

I made it so that when you use the command to view statistics, you check if you are in the database. If not, then it adds you and displays your statistics, if you were already in the database, then just display statistics

errant heron
split vault
#

.close