mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2024-11-23 03:38:08 -06:00
Quoted tweets are saved in mentions, added quoted tweet event handler
This commit is contained in:
parent
5b49be315c
commit
b7bc53bb92
@ -66,7 +66,11 @@ class streamer(TwythonStreamer):
|
|||||||
if "@%s" % (self.session.db["user_name"]) in data["text"]:
|
if "@%s" % (self.session.db["user_name"]) in data["text"]:
|
||||||
self.put_data("mentions", data)
|
self.put_data("mentions", data)
|
||||||
pub.sendMessage("mention", data=data, user=self.get_user())
|
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):
|
def process_dm(self, data):
|
||||||
if self.session.db["user_name"] == data["direct_message"]["sender"]["screen_name"]:
|
if self.session.db["user_name"] == data["direct_message"]["sender"]["screen_name"]:
|
||||||
self.put_data("sent_direct_messages", data["direct_message"])
|
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"])
|
list = utils.find_item(id, self.session.db["lists"])
|
||||||
if list != None: self.session.db["lists"].pop(list)
|
if list != None: self.session.db["lists"].pop(list)
|
||||||
pub.sendMessage("list-deleted", **{"item":list, "user":self.get_user()})
|
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"]:
|
if "events" in self.session.settings["general"]["buffer_order"]:
|
||||||
pub.sendMessage("event", data= data, user= self.get_user())
|
pub.sendMessage("event", data= data, user= self.get_user())
|
||||||
# self.sound.play("new_event.ogg")
|
# self.sound.play("new_event.ogg")
|
||||||
|
@ -128,6 +128,8 @@ def compose_event(data, username):
|
|||||||
elif data["event"] == "retweeted_retweet":
|
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"])
|
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"])
|
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:
|
else:
|
||||||
event = _("Unknown")
|
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"]))
|
log.error("event: %s\n target: %s\n source: %s\n target_object: %s" % (data["event"], data["target"], data["source"], data["target_object"]))
|
||||||
|
Loading…
Reference in New Issue
Block a user