Skip to content

Instantly share code, notes, and snippets.

@MemphisMeng
Created August 19, 2020 21:46
Show Gist options
  • Save MemphisMeng/ad83f9ce612ec5cd329e5444dc59d050 to your computer and use it in GitHub Desktop.
Save MemphisMeng/ad83f9ce612ec5cd329e5444dc59d050 to your computer and use it in GitHub Desktop.
response, similarity = transformer.match_query(message['message'].get('text'))
# no acceptable answers found in the pool
if similarity < 0.5:
response = "Please wait! Our representative is on the way to help you!"
bot.send_text_message(recipient_id, response)
else:
responses = response.split('|')
for r in responses:
if r != '':
bot.send_text_message(recipient_id, r.strip())
insert(message, response)
# if user sends us a GIF, photo,video, or any other non-text item
if message['message'].get('attachments'):
i = 0
while i < 1:
bot.send_text_message(recipient_id, "Interesting! Anything else I could help?")
i += 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment