0

I have a (hopefully) simple question about a boolean function. I am trying to set up a simple auto replier, but for some reason it returns no errors but just does not work. I am not sure why, it seems like it's not registering that I have set afk to equal True. I'm stuck. Any help?

    afk = False #set to default as False
    if Status == 'SENT' or (Status == 'RECEIVED'):
        if Message.Body.lower() == '!afk on':
            afk = True #set "on"
            Message.Chat.SendMessage("AFK ON")

        elif Message.Body.lower() == '!afk off':
            afk = False #turn off
            Message.Chat.SendMessage("AFK OFF")

    if afk == True and (Status == 'SENT' or Status == 'RECEIVED'): #if its true AND in a message
        if 'myname' in Message.Body.lower():
            Message.Chat.SendMessage("I'm not here. Be back soon!")
4

1 回答 1

2

Your code looks right, so if afk stays False is because the line where it gets to True is never executed.

Try adding print statements at each conditional case, printing the STATUS and the value Message.Body.lower(), so you are able to see these values at execution time.

于 2013-09-12T14:36:54.730 回答