-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbot.py
More file actions
24 lines (19 loc) · 790 Bytes
/
bot.py
File metadata and controls
24 lines (19 loc) · 790 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from flask import Flask, request
from twilio.twiml.messaging_response import MessagingResponse
from getMenuData import data
from makeResponse import response
from app import webhook_app
webhook_app = Flask(__name__)
@webhook_app.route('/bot', methods=['POST'])
def bot():
incoming_msg = request.values.get('Body', '').lower()
resp = MessagingResponse()
msg = resp.message()
outMess = response(incoming_msg, data)
if len(outMess) > 1600:
outMess = outMess[:1350] + \
"...\n\n This message would be too long for the API to handle. If you want more info please select a specific meal time by including it in the message.\n E.g. \"Eagle's Nest Breakfast\""
msg.body(outMess)
return str(resp)
if __name__ == '__main__':
webhook_app.run()