vendredi 6 août 2021

How to use a if statement inside of a while loop

I am currently messing around with a discord bot and I am trying to get it to say E continuously but stop when someone says *E stop. However, with how I have it at the moment it does not work does. Anyone know why?

E = False

if message.content.startswith('*E start'):
    E = True
    await message.channel.send('E is beginning!!!')
    while E == True:
       time.sleep(1)
       await message.channel.send('E')
       if message.content.startswith('*E stop'):
            E = False

Aucun commentaire:

Enregistrer un commentaire