-
Notifications
You must be signed in to change notification settings - Fork 991
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b5deccd
commit 5128bf1
Showing
3 changed files
with
30 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import config | ||
import json | ||
import os | ||
import requests | ||
import sys | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from copy import deepcopy as copy | ||
|
||
QUICK_REPLIES_LIMIT = 10 | ||
TITLE_CHARACTER_LIMIT = 20 | ||
PAYLOAD_CHARACTER_LIMIT = 1000 | ||
|
||
def add_quick_reply(message, title='', payload=''): | ||
message_with_quick_reply = copy(message) | ||
if 'quick_replies' not in message_with_quick_reply: | ||
message_with_quick_reply['quick_replies'] = [] | ||
if len(message_with_quick_reply['quick_replies']) < QUICK_REPLIES_LIMIT: | ||
quick_reply = {} | ||
# TODO: location + image_url | ||
quick_reply['content_type'] = 'text' | ||
quick_reply['title'] = title[:TITLE_CHARACTER_LIMIT] | ||
quick_reply['payload'] = payload[:PAYLOAD_CHARACTER_LIMIT] | ||
message_with_quick_reply['quick_replies'].append(quick_reply) | ||
return message_with_quick_reply |