@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)
millis = input(data[str(member.id)]['Онлайн'])
millis = int(millis)
seconds = (millis/1000)%60
seconds = int(seconds)
minutes = (millis/(1000*60))%60
minutes = int(minutes)
hours = (millis/(1000*60*60))%24
if before.channel is None and after.channel is not None:
t1 = time.time()
data[str(member.id)]['Онлайн'] = t1
elif before.channel is not None and after.channel is None and member.id in tdict:
t2 = time.time()
delta = t2-tdict[member.id]
print(datetime.timedelta(seconds = delta))
data[str(member.id)]['Онлайн'] + data[str(member.id)("%d:%d:%d" % (hours, minutes, seconds))
with open('c:/Python/TOXBOT/database.json', 'w', encoding = "utf-8") as file:
json.dump(data, file)