From e15cd8664462b5e949f3cea004acef8eb38096b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20Cort=C3=A9z?= Date: Tue, 17 Mar 2015 03:39:59 -0600 Subject: [PATCH] Two new events added in the events API --- src/twitter/compose.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/twitter/compose.py b/src/twitter/compose.py index 77ffae19..16811aab 100644 --- a/src/twitter/compose.py +++ b/src/twitter/compose.py @@ -6,6 +6,8 @@ import time import output import languageHandler import arrow +import logging +log = logging.getLogger("compose") def StripChars(s): """Converts any html entities in s to their unicode-decoded equivalents and returns a string.""" @@ -102,8 +104,12 @@ def compose_event(data, username): elif data["event"] == "list_user_unsubscribed": if data["source"]["screen_name"] == username: event = _(u"You've unsubscribed from the list %s, which is owned by %s(@%s)") % (data["target_object"]["name"], data["target"]["name"], data["target"]["screen_name"]) else: event = _("You've been unsubscribed from the list %s, which is owned by %s(@%s)") % (data["target_object"]["name"], data["source"]["name"], data["source"]["screen_name"]) - else: event = _("Unknown") -# output.speak(event) + elif data["event"] == "retweeted_retweet": + if data["source"]["screen_name"] == username: event = _(u"You have retweeted a retweet from %s(@%s): %s" % (data["target"]["name"], data["target"]["screen_name"], data["target_object"]["text"])) + else: event = _(u"%s(@%s) has retweeted your retweet: %s" % (data["source"]["name"], data["source"]["screen_name"], data["target_object"]["text"])) + else: + event = _("Unknown") + log.error("event: %s\n target: %s\n source: %s\n target_object: %s" % (data["event"], data["target"], data["source"], data["target_object"])) return [time.strftime("%I:%M %p"), event] def compose_list(list):