1
저는 트 위치에 봇을 사용하고 있으며 사용자가 채널에서 보낸 시간을 추적합니다. !time You have spent 10 seconds in the stream
. 그러나 여러 사용자가이 명령을 사용하는 경우 !time
각 사용자마다 별도의 '개수'가 없습니다. 예 :사용자가 목록에 얼마나 오랫동안 있었는지 테스트
Rustie: !time
Bot: Rustie, you have 20 seconds in the stream.
~1 minute later~
John: !time
Bot: John, you have 1 minute 20 seconds in the stream.
내 현재 코드 :
usersForTime = []
if "time" in message:
if user in usersForTime:
endTime = time.time() # I already made startTime in the !start command (which starts the time tracker in the first place)
ellapsed = (endTime - startTime)
sendMessage(s, user + ", you have " + "%.2f" % round(ellapsed, 2) + " seconds in the stream.")
else:
sendMessage(s ,"You need to start tracking your time with the !start command.")