def get_notifications(self):
"""
Not working since facebooks new update which doesn't allow notifications to be fetched. :(
Responds to user-input, typically speech text, with a summary of
the user's Facebook notifications, including a count and details
related to each individual notification.
Arguments:
text -- user-input, typically transcribed speech
self.assistant -- used to interact with the user (for both input and output)
profile -- contains information related to the user (e.g., phone
number)
"""
try:
results = self.graph.request("me/notifications")
except facebook.GraphAPIError:
response = ("I have not been authorized to query your Facebook. If you " +
"would like to check your notifications in the future, " +
"please visit the Stephanie facebook module configuraton.")
return response
except:
return "I apologize, there's a problem with that service at the moment."
if not len(results['data']):
return "You have no Facebook notifications."
updates = []
for notification in results['data']:
updates.append(notification['title'])
count = len(results['data'])
response = ("You have " + str(count) +
" Facebook notifications. " + " ".join(updates) + ". ")
return response
评论列表
文章目录