mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2025-01-31 13:20:45 -06:00
Fixed replies, retweets and iand tweet deletion
This commit is contained in:
parent
3db8b7b021
commit
76c678d4ba
@ -171,7 +171,7 @@ class baseBufferController(baseBuffers.buffer):
|
|||||||
if "-timeline" in self.name:
|
if "-timeline" in self.name:
|
||||||
self.username = val[0].user.screen_name
|
self.username = val[0].user.screen_name
|
||||||
elif "-favorite" in self.name:
|
elif "-favorite" in self.name:
|
||||||
self.username = self.session.api_call("show_user", **self.kwargs)["screen_name"]
|
self.username = self.session.api_call("get_user", **self.kwargs).screen_name
|
||||||
self.finished_timeline = True
|
self.finished_timeline = True
|
||||||
if number_of_items > 0 and self.name != "sent_tweets" and self.name != "sent_direct_messages" and self.sound != None and self.session.settings["sound"]["session_mute"] == False and self.name not in self.session.settings["other_buffers"]["muted_buffers"] and play_sound == True:
|
if number_of_items > 0 and self.name != "sent_tweets" and self.name != "sent_direct_messages" and self.sound != None and self.session.settings["sound"]["session_mute"] == False and self.name not in self.session.settings["other_buffers"]["muted_buffers"] and play_sound == True:
|
||||||
self.session.sound.play(self.sound)
|
self.session.sound.play(self.sound)
|
||||||
@ -262,7 +262,7 @@ class baseBufferController(baseBuffers.buffer):
|
|||||||
def remove_tweet(self, id):
|
def remove_tweet(self, id):
|
||||||
if type(self.session.db[self.name]) == dict: return
|
if type(self.session.db[self.name]) == dict: return
|
||||||
for i in range(0, len(self.session.db[self.name])):
|
for i in range(0, len(self.session.db[self.name])):
|
||||||
if self.session.db[self.name][i]["id"] == id:
|
if self.session.db[self.name][i].id == id:
|
||||||
self.session.db[self.name].pop(i)
|
self.session.db[self.name].pop(i)
|
||||||
self.remove_item(i)
|
self.remove_item(i)
|
||||||
|
|
||||||
@ -387,9 +387,9 @@ class baseBufferController(baseBuffers.buffer):
|
|||||||
@_tweets_exist
|
@_tweets_exist
|
||||||
def reply(self, *args, **kwargs):
|
def reply(self, *args, **kwargs):
|
||||||
tweet = self.get_right_tweet()
|
tweet = self.get_right_tweet()
|
||||||
screen_name = tweet.user["screen_name"]
|
screen_name = tweet.user.screen_name
|
||||||
id = tweet.id
|
id = tweet.id
|
||||||
twishort_enabled = getattr(tweet, "twishort")
|
twishort_enabled = hasattr(tweet, "twishort")
|
||||||
users = utils.get_all_mentioned(tweet, self.session.db, field="screen_name")
|
users = utils.get_all_mentioned(tweet, self.session.db, field="screen_name")
|
||||||
ids = utils.get_all_mentioned(tweet, self.session.db, field="id_str")
|
ids = utils.get_all_mentioned(tweet, self.session.db, field="id_str")
|
||||||
# Build the window title
|
# Build the window title
|
||||||
@ -434,7 +434,7 @@ class baseBufferController(baseBuffers.buffer):
|
|||||||
def send_message(self, *args, **kwargs):
|
def send_message(self, *args, **kwargs):
|
||||||
tweet = self.get_right_tweet()
|
tweet = self.get_right_tweet()
|
||||||
if self.type == "dm":
|
if self.type == "dm":
|
||||||
screen_name = self.session.get_user(tweet.message_create["sender_id"])["screen_name"]
|
screen_name = self.session.get_user(tweet.message_create["sender_id"]).screen_name
|
||||||
users = [screen_name]
|
users = [screen_name]
|
||||||
elif self.type == "people":
|
elif self.type == "people":
|
||||||
screen_name = tweet.screen_name
|
screen_name = tweet.screen_name
|
||||||
@ -451,10 +451,10 @@ class baseBufferController(baseBuffers.buffer):
|
|||||||
val = self.session.api_call(call_name="send_direct_message", recipient_id=recipient_id, text=text)
|
val = self.session.api_call(call_name="send_direct_message", recipient_id=recipient_id, text=text)
|
||||||
if val != None:
|
if val != None:
|
||||||
if self.session.settings["general"]["reverse_timelines"] == False:
|
if self.session.settings["general"]["reverse_timelines"] == False:
|
||||||
self.session.db["sent_direct_messages"]["items"].append(val["event"])
|
self.session.db["sent_direct_messages"]["items"].append(val)
|
||||||
else:
|
else:
|
||||||
self.session.db["sent_direct_messages"]["items"].insert(0, val["event"])
|
self.session.db["sent_direct_messages"]["items"].insert(0, val)
|
||||||
pub.sendMessage("sent-dm", data=val["event"], user=self.session.db["user_name"])
|
pub.sendMessage("sent-dm", data=val, user=self.session.db["user_name"])
|
||||||
if hasattr(dm.message, "destroy"): dm.message.destroy()
|
if hasattr(dm.message, "destroy"): dm.message.destroy()
|
||||||
|
|
||||||
@_tweets_exist
|
@_tweets_exist
|
||||||
@ -480,12 +480,12 @@ class baseBufferController(baseBuffers.buffer):
|
|||||||
comments = tweet.full_text
|
comments = tweet.full_text
|
||||||
else:
|
else:
|
||||||
comments = tweet.text
|
comments = tweet.text
|
||||||
retweet = messages.tweet(self.session, _(u"Quote"), _(u"Add your comment to the tweet"), u"“@%s: %s ”" % (tweet.user["screen_name"], comments), max=256, messageType="retweet")
|
retweet = messages.tweet(self.session, _(u"Quote"), _(u"Add your comment to the tweet"), u"“@%s: %s ”" % (tweet.user.screen_name, comments), max=256, messageType="retweet")
|
||||||
if comment != '':
|
if comment != '':
|
||||||
retweet.message.set_text(comment)
|
retweet.message.set_text(comment)
|
||||||
if retweet.message.get_response() == widgetUtils.OK:
|
if retweet.message.get_response() == widgetUtils.OK:
|
||||||
text = retweet.message.get_text()
|
text = retweet.message.get_text()
|
||||||
text = text+" https://twitter.com/{0}/status/{1}".format(tweet.user["screen_name"], id)
|
text = text+" https://twitter.com/{0}/status/{1}".format(tweet.user.screen_name, id)
|
||||||
if retweet.image == None:
|
if retweet.image == None:
|
||||||
item = self.session.api_call(call_name="update_status", _sound="retweet_send.ogg", status=text, in_reply_to_status_id=id, tweet_mode="extended")
|
item = self.session.api_call(call_name="update_status", _sound="retweet_send.ogg", status=text, in_reply_to_status_id=id, tweet_mode="extended")
|
||||||
if item != None:
|
if item != None:
|
||||||
@ -496,7 +496,7 @@ class baseBufferController(baseBuffers.buffer):
|
|||||||
if hasattr(retweet.message, "destroy"): retweet.message.destroy()
|
if hasattr(retweet.message, "destroy"): retweet.message.destroy()
|
||||||
|
|
||||||
def _direct_retweet(self, id):
|
def _direct_retweet(self, id):
|
||||||
item = self.session.api_call(call_name="retweet", _sound="retweet_send.ogg", id=id, tweet_mode="extended")
|
item = self.session.api_call(call_name="retweet", _sound="retweet_send.ogg", id=id)
|
||||||
if item != None:
|
if item != None:
|
||||||
# Retweets are returned as non-extended tweets, so let's get the object as extended
|
# Retweets are returned as non-extended tweets, so let's get the object as extended
|
||||||
# just before sending the event message. See https://github.com/manuelcortez/TWBlue/issues/253
|
# just before sending the event message. See https://github.com/manuelcortez/TWBlue/issues/253
|
||||||
@ -582,7 +582,7 @@ class baseBufferController(baseBuffers.buffer):
|
|||||||
def user_details(self):
|
def user_details(self):
|
||||||
tweet = self.get_right_tweet()
|
tweet = self.get_right_tweet()
|
||||||
if self.type == "dm":
|
if self.type == "dm":
|
||||||
users = [self.session.get_user(tweet.message_create["sender_id"])["screen_name"]]
|
users = [self.session.get_user(tweet.message_create["sender_id"]).screen_name]
|
||||||
elif self.type == "people":
|
elif self.type == "people":
|
||||||
users = [tweet.screen_name]
|
users = [tweet.screen_name]
|
||||||
else:
|
else:
|
||||||
@ -604,7 +604,7 @@ class baseBufferController(baseBuffers.buffer):
|
|||||||
def open_in_browser(self, *args, **kwargs):
|
def open_in_browser(self, *args, **kwargs):
|
||||||
tweet = self.get_tweet()
|
tweet = self.get_tweet()
|
||||||
output.speak(_(u"Opening item in web browser..."))
|
output.speak(_(u"Opening item in web browser..."))
|
||||||
url = "https://twitter.com/{screen_name}/status/{tweet_id}".format(screen_name=tweet.user["screen_name"], tweet_id=tweet.id)
|
url = "https://twitter.com/{screen_name}/status/{tweet_id}".format(screen_name=tweet.user.screen_name, tweet_id=tweet.id)
|
||||||
webbrowser.open(url)
|
webbrowser.open(url)
|
||||||
|
|
||||||
class directMessagesController(baseBufferController):
|
class directMessagesController(baseBufferController):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user