Quoted tweets are saved in mentions, added quoted tweet event handler

This commit is contained in:
Manuel Cortez 2015-07-06 09:45:56 -05:00
parent 5b49be315c
commit b7bc53bb92
2 changed files with 10 additions and 1 deletions

View File

@ -67,6 +67,10 @@ class streamer(TwythonStreamer):
self.put_data("mentions", data)
pub.sendMessage("mention", data=data, user=self.get_user())
def set_quoted_tweet(self, data):
self.put_data("mentions", data)
pub.sendMessage("mention", data=data, user=self.get_user())
def process_dm(self, data):
if self.session.db["user_name"] == data["direct_message"]["sender"]["screen_name"]:
self.put_data("sent_direct_messages", data["direct_message"])
@ -148,6 +152,9 @@ class streamer(TwythonStreamer):
list = utils.find_item(id, self.session.db["lists"])
if list != None: self.session.db["lists"].pop(list)
pub.sendMessage("list-deleted", **{"item":list, "user":self.get_user()})
elif "quoted_tweet" == data["event"]:
self.set_quoted_tweet(data["target_object"])
if "events" in self.session.settings["general"]["buffer_order"]:
pub.sendMessage("event", data= data, user= self.get_user())
# self.sound.play("new_event.ogg")

View File

@ -128,6 +128,8 @@ def compose_event(data, username):
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"]["retweeted_status"]["text"])
else: event = _(u"%s(@%s) has retweeted your retweet: %s") % (data["source"]["name"], data["source"]["screen_name"], data["target_object"]["retweeted_status"]["text"])
elif data["event"] == "quoted_tweet":
event = _(u"@{0} quoted your tweet: {1}").format(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"]))