I'm making an automated whatsapp reply bot using Twilio and python, however I am facing problems and am unable to used nested if else in it
from flask import Flask, request
import requests
from twilio.twiml.messaging_response import MessagingResponse
app = Flask(__name__)
@app.route('/mybot', methods = ['POST'])
def mybot():
incoming_msg = request.values.get('Body', '').lower()
resp = MessagingResponse()
msg = resp.message()
responded = False
print(incoming_msg)
if incoming_msg == "list of doctors":
msg.body("We have Dr. Phil with us today")
responded = True
if "book appointment" in str.lower(incoming_msg) or "see a doctor" in str.lower(incoming_msg):
msg.body("Which department would you like to visit?\nPress :-\n1 - General Surgery\n2 - Internal Medicine\n3 - Gynaecology\n4 - Obstetrics\n5 - Ophthalmology\n6 - Orthopaedics\n7 - Dermatology Venereology & Leprology\n8 - ENT\n9 - Paediatric")
if (incoming_msg == "1" or "general surgery" in incoming_msg): # This statement gets ignored
msg.body("General Surgery")
responded = True
where if (incoming_msg == "1" or "general surgery" in incoming_msg):
is the problem statement.
Is there any way to work this out?