I'm new to django python so the if makes me feel confused. Please help me!
Im trying to make a IF condition for Facebook chat bot API. The whole function is when a user sends something in the Facebook chat, my bot will remove all punctuations, lower case the text and split it based on space.
After that he will pick a joke from json list with the keyword he got. A quick reply with 2 buttons "Yes" and "No" is also sent to user with the joke.
It also checks if the keyword is absent. Now I want that when user types "No" in the chat, my bot will send something back like "Then not". What did I do wrong here?
strong texttokens = re.sub(r"[^a-zA-Z0-9\s]", ' ', recevied_message).lower().split()
joke_text = ''
for token in tokens:
if token in jokes:
joke_text = random.choice(jokes[token])
.... some code
quick_text = "Do you want another joke? "
if not joke_text:
joke_text = "I didn't understand! " \
"Send 'stupid', 'fat', 'dumb' for a Yo Mama joke!"
joke_text = "Then not"
is always true, you probably want to be checking if something == 'No'?