How can I count time in Python 3?

I want a code that shows the complet time someone has been in a voicechannel but I dont know how to start and stop a counter.

    @bot.event
    async def on_voice_state_update(before, after):

        if after.voice.voice_channel:
            timestrr = time.strftime("%d.%m.%Y-%H:%M:%S")
            voicezeit(after.id, timestrr)
    #here should a timer start
        else:
             #and here should the timer stop

I really dont know how to do this so I would really appreciate every help.

Leave a Comment