in src/services/messenger.py [0:0]
def process_message(messenger, message):
if "attachments" in message["message"]:
if message["message"]["attachments"][0]["type"] == "location":
logger.debug("Location received")
attachments = message["message"]["attachments"]
response = Text(
text="{}: lat: {}, long: {}".format(
message["message"]["attachments"][0]["title"],
attachments[0]["payload"]["coordinates"]["lat"],
attachments[0]["payload"]["coordinates"]["long"],
)
)
res = messenger.send(response.to_dict(), "RESPONSE")
logger.debug("Response: {}".format(res))
return True
if (
"quick_reply" in message["message"]
and "payload" in message["message"]["quick_reply"]
):
payload = message["message"]["quick_reply"]["payload"]
process_postback(messenger, payload)
return True
text = None
if "text" in message["message"]:
msg = message["message"]["text"]
if msg.lower() in ["help", "info"]:
text = {
"text": _(
u"Oh you need some help 🆘!"
" This is the main menu, select what you need below 👇🏼"
),
"quick_replies": get_main_menu().to_dict(),
}
else:
user["msg"] = msg
text = {
"text": _(
u"I didn't get you %(first_name)s"
"!\nYou said : %(msg)s\n"
"\nThis is the main menu, select what you need below 👇🏼",
**user
),
"quick_replies": get_main_menu().to_dict(),
}
if not text:
text = {
"text": _(
u"%(first_name)s\n"
"This is the main menu, select what you need below 👇🏼"
),
"quick_replies": get_main_menu().to_dict(),
}
messenger.send(text, "RESPONSE")
return True