Как начислить валюту за нахождение в войсе?
@client.event
async def on_voice_state_update(member, before, after):
with open('economy.json','r') as f:
money = json.load(f)
author = member.id
if before.channel is None and after.channel is not None:
print('1')
t1 = time.time()
tdict[author] = t1
elif before.channel is not None and after.channel is None and author in tdict:
t2 = time.time()
print('0')
print(t2-tdict[author])
tdict1[author] = t2
else:
await (tdict1[author]-tdict[author]) > 13
money[str(author)]['Money'] += 1
with open('economy.json','w') as f:
json.dump(money,f)
Выдает ошибку:Ignoring exception in on_voice_state_update
Traceback (most recent call last):
File "D:\Users\Jason\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "Ice.py", line 468, in on_voice_state_update
await (tdict1[author]-tdict[author]) > 13
NameError: name 'tdict1' is not defined