Fixed reply and toot things to make it work properly

This commit is contained in:
Manuel Cortez 2022-11-09 10:20:14 -06:00
parent c0654658b5
commit c6433d8655
No known key found for this signature in database
GPG Key ID: 9E0735CA15EFE790
2 changed files with 8 additions and 8 deletions

View File

@ -63,7 +63,7 @@ class BaseBuffer(base.Buffer):
response = toot.message.ShowModal()
if response == wx.ID_OK:
toot_data = toot.get_tweet_data()
call_threaded(self.session.send_toot, *toot_data)
call_threaded(self.session.send_toot, toots=toot_data)
if hasattr(toot.message, "destroy"):
toot.message.destroy()
@ -272,9 +272,9 @@ class BaseBuffer(base.Buffer):
if response == wx.ID_OK:
toot_data = toot.get_tweet_data()
users = toot.get_people()
if users == "" and item.account.id != self.session.db["user_id"]:
users = users +"@{}".format(item.account.acct)
call_threaded(self.session.send_toot, item.id, users, *toot_data)
if item.account.acct not in users and item.account.id != self.session.db["user_id"]:
users = "@{} {}".format(item.account.acct, users)
call_threaded(self.session.send_toot, reply_to=item.id, users=users, toots=toot_data)
if hasattr(toot.message, "destroy"):
toot.message.destroy()

View File

@ -142,21 +142,21 @@ class Session(base.baseSession):
if _sound != None: self.sound.play(_sound)
return val
def send_toot(self, reply_to=None, users=None, *toots):
def send_toot(self, reply_to=None, users=None, visibility=None, toots=[]):
""" Convenience function to send a thread. """
in_reply_to_id = reply_to
for obj in toots:
if users != None:
text = "{} {}".format(users, obj.get("text"))
text = users+obj.get("text")
else:
text = obj.get("text")
if len(obj["attachments"]) == 0:
item = self.api_call(call_name="status_post", status=text, _sound="tweet_send.ogg", in_reply_to_id=in_reply_to_id)
item = self.api_call(call_name="status_post", status=text, _sound="tweet_send.ogg", in_reply_to_id=in_reply_to_id, visibility=visibility)
in_reply_to_id = item["id"]
else:
media_ids = []
for i in obj["attachments"]:
img = self.api_call("media_post", media_file=i["file"], description=i["description"])
media_ids.append(img.id)
item = self.api_call(call_name="status_post", status=text, _sound="tweet_send.ogg", in_reply_to_id=in_reply_to_id, media_ids=media_ids)
item = self.api_call(call_name="status_post", status=text, _sound="tweet_send.ogg", in_reply_to_id=in_reply_to_id, media_ids=media_ids, visibility=visibility)
in_reply_to_id = item["id"]