H
H
hriston2021-06-03 18:35:32
SQLite
hriston, 2021-06-03 18:35:32

How to make user ids work in sqlite3?

Hello. I wanted to make a coin system in my bot. When people sit in a voice chat, they should receive 3 coins per 1 minute, but when I get IDs and use them, it says that such a column does not exist, although in fact it does. Please help if anyone knows what is wrong. I already have id and cash columns.

As for the fact that the accrual is when the microphone is turned on and off, then I'm just for the test.

@client.event
async def on_voice_state_update(member: discord.Member, before, after, amount = None):
    #voice_channel = discord.utils.get(member.guild.channels, id=after.channel.id)
    if not after.channel:
    # на случай если человек вышел из канала
        return
    channel = client.get_channel(847143290054246415)
    #channel2 = client.get_channel(847143290054246416)
    members = channel.members
    #members2 = channel2.members
    memids = []
    for member in members:
    	memids.append(member.id)
    if len(after.channel.members) > 1:
        #print(f"{memids}")
        if after.mute or after.self_mute:
            cursor.execute("UPDATE users SET cash = cash + 3 WHERE id = {}".format(member.id))	
            connection.commit()
            return

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