mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2024-11-23 03:38:08 -06:00
Added full Twishort support
This commit is contained in:
parent
64fce8fb54
commit
74bcc36968
@ -130,6 +130,11 @@ class bufferController(object):
|
||||
tweet = messages.tweet(self.session, title, caption, "")
|
||||
if tweet.message.get_response() == widgetUtils.OK:
|
||||
text = tweet.message.get_text()
|
||||
if len(text) > 140 and tweet.message.get("long_tweet") == True:
|
||||
if tweet.image == None:
|
||||
text = twishort.create_tweet(self.session.settings["twitter"]["user_key"], self.session.settings["twitter"]["user_secret"], text)
|
||||
else:
|
||||
text = twishort.create_tweet(self.session.settings["twitter"]["user_key"], self.session.settings["twitter"]["user_secret"], text, 1)
|
||||
if tweet.image == None:
|
||||
call_threaded(self.session.api_call, call_name="update_status", status=text)
|
||||
else:
|
||||
@ -371,10 +376,16 @@ class baseBufferController(bufferController):
|
||||
users = utils.get_all_mentioned(tweet, self.session.db)
|
||||
message = messages.reply(self.session, _(u"Reply"), _(u"Reply to %s") % (screen_name,), "@%s " % (screen_name,), users)
|
||||
if message.message.get_response() == widgetUtils.OK:
|
||||
text = message.message.get_text()
|
||||
if len(text) > 140 and message.message.get("long_tweet") == True:
|
||||
if message.image == None:
|
||||
call_threaded(self.session.api_call, call_name="update_status", _sound="reply_send.ogg", in_reply_to_status_id=id, status=message.message.get_text())
|
||||
text = twishort.create_tweet(self.session.settings["twitter"]["user_key"], self.session.settings["twitter"]["user_secret"], text)
|
||||
else:
|
||||
call_threaded(self.session.api_call, call_name="update_status_with_media", _sound="reply_send.ogg", in_reply_to_status_id=id, status=message.message.get_text(), media=message.file)
|
||||
text = twishort.create_tweet(self.session.settings["twitter"]["user_key"], self.session.settings["twitter"]["user_secret"], text, 1)
|
||||
if message.image == None:
|
||||
call_threaded(self.session.api_call, call_name="update_status", _sound="reply_send.ogg", in_reply_to_status_id=id, status=text)
|
||||
else:
|
||||
call_threaded(self.session.api_call, call_name="update_status_with_media", _sound="reply_send.ogg", in_reply_to_status_id=id, status=text, media=message.file)
|
||||
if hasattr(message.message, "destroy"): message.message.destroy()
|
||||
|
||||
@_tweets_exist
|
||||
|
@ -36,3 +36,11 @@ def get_full_text(uri):
|
||||
return r.json()["text"]
|
||||
# except:
|
||||
# return False
|
||||
|
||||
def create_tweet(user_token, user_secret, text, media=0):
|
||||
data = {"user_token": user_token,
|
||||
"user_secret": user_secret,
|
||||
"text": text.encode("utf-8"),
|
||||
"media": media}
|
||||
response = requests.post("http://twblue.es/twishort.php", data=data)
|
||||
return response.json()["text_to_tweet"]
|
@ -73,6 +73,8 @@ class tweet(textLimited):
|
||||
self.mainBox = wx.BoxSizer(wx.VERTICAL)
|
||||
self.createTextArea(message, text)
|
||||
self.mainBox.Add(self.textBox, 0, wx.ALL, 5)
|
||||
self.long_tweet = wx.CheckBox(self.panel, -1, _(u"Long tweet"))
|
||||
self.long_tweet.SetValue(True)
|
||||
self.upload_image = wx.Button(self.panel, -1, _(u"Upload image..."), size=wx.DefaultSize)
|
||||
self.spellcheck = wx.Button(self.panel, -1, _("Check spelling..."), size=wx.DefaultSize)
|
||||
self.attach = wx.Button(self.panel, -1, _(u"Attach audio..."), size=wx.DefaultSize)
|
||||
|
Loading…
Reference in New Issue
Block a user