S
S
shadowzxc2021-06-27 01:13:01
Python
shadowzxc, 2021-06-27 01:13:01

How to make a command that will show all the hours and minutes for being in the voice on the server?

How to make a command that could show all the hours and minutes of being on the server in voice channels when it is entered? The command itself is already there and @bot.event:

@bot.event
async def on_voice_state_update(member, before, after):
    with open('c:/Python/TOXBOT/database.json', 'r', encoding = "utf-8") as file:
        data = json.load(file)
    author = member.id
    if before.channel is None and after.channel is not None:
        t1 = time.time()
        data[str(author)]['Онлайн'] = t1
    elif before.channel is not None and after.channel is None and author in tdict:
        t2 = time.time() 
        print(t2-tdict[author])
        data[str(author)]['Онлайн'] + data[str(author)]
    with open('c:/Python/TOXBOT/database.json', 'w', encoding = "utf-8") as file:
        json.dump(data, file)

What is missing and what errors (if any)? discord.py

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