mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2024-11-22 11:18:08 -06:00
Quote tweets properly according to Twitter's API V2 docs
This commit is contained in:
parent
b329ac8e3e
commit
d6571a95cb
@ -459,11 +459,11 @@ class BaseBuffer(base.Buffer):
|
||||
retweet = messages.tweet(session=self.session, title=_("Quote"), caption=_("Add your comment to the tweet"), max=256, thread_mode=False)
|
||||
if retweet.message.ShowModal() == widgetUtils.OK:
|
||||
text = retweet.message.text.GetValue()
|
||||
text = text+" https://twitter.com/{0}/status/{1}".format(self.session.get_user(tweet.user).screen_name, id)
|
||||
tweet_data = dict(text=text, attachments=retweet.attachments, poll_period=retweet.poll_period, poll_options=retweet.poll_options)
|
||||
tweet_data.update(quote_tweet_id=id)
|
||||
call_threaded(self.session.send_tweet, *[tweet_data])
|
||||
if hasattr(retweet.message, "destroy"):
|
||||
retweet.message.destroy()
|
||||
retweet.message.Destroy()
|
||||
|
||||
def _direct_retweet(self, id):
|
||||
item = self.session.api_call(call_name="retweet", _sound="retweet_send.ogg", id=id)
|
||||
|
@ -620,8 +620,9 @@ class Session(base.baseSession):
|
||||
""" Convenience function to send a thread. """
|
||||
in_reply_to_status_id = None
|
||||
for obj in tweets:
|
||||
# When quoting a tweet, the tweet_data dict might contain a parameter called quote_tweet_id. Let's add it, or None, so quotes will be posted successfully.
|
||||
if len(obj["attachments"]) == 0:
|
||||
item = self.api_call_v2(call_name="create_tweet", text=obj["text"], _sound="tweet_send.ogg", in_reply_to_tweet_id=in_reply_to_status_id, poll_duration_minutes=obj["poll_period"], poll_options=obj["poll_options"])
|
||||
item = self.api_call_v2(call_name="create_tweet", text=obj["text"], _sound="tweet_send.ogg", in_reply_to_tweet_id=in_reply_to_status_id, poll_duration_minutes=obj["poll_period"], poll_options=obj["poll_options"], quote_tweet_id=obj.get("quote_tweet_id"))
|
||||
in_reply_to_status_id = item.data["id"]
|
||||
else:
|
||||
media_ids = []
|
||||
@ -630,7 +631,7 @@ class Session(base.baseSession):
|
||||
if i["type"] == "photo":
|
||||
self.api_call(call_name="create_media_metadata", media_id=img.media_id, alt_text=i["description"])
|
||||
media_ids.append(img.media_id)
|
||||
item = self.api_call_v2(call_name="create_tweet", status=obj["text"], _sound="tweet_send.ogg", in_reply_to_tweet_id=in_reply_to_status_id, media_ids=media_ids, poll_duration_minutes=obj["poll_period"], poll_options=obj["poll_options"])
|
||||
item = self.api_call_v2(call_name="create_tweet", status=obj["text"], _sound="tweet_send.ogg", in_reply_to_tweet_id=in_reply_to_status_id, media_ids=media_ids, poll_duration_minutes=obj["poll_period"], poll_options=obj["poll_options"], quote_tweet_id=obj.get("quote_tweet_id"))
|
||||
in_reply_to_status_id = item.data["id"]
|
||||
|
||||
def reply(self, text="", in_reply_to_status_id=None, attachments=[], *args, **kwargs):
|
||||
|
Loading…
Reference in New Issue
Block a user