Clean up status_reply a little (fixes #189)

This commit is contained in:
Lorenz Diener 2019-10-12 19:26:57 +02:00
pare 50717ce548
commit 5e776519ef

Veure arxiu

@ -1611,9 +1611,10 @@ class Mastodon:
return self.status_post(status) return self.status_post(status)
@api_version("1.0.0", "2.8.0", __DICT_VERSION_STATUS) @api_version("1.0.0", "2.8.0", __DICT_VERSION_STATUS)
def status_reply(self, to_status, status, media_ids=None, sensitive=False, visibility=None, def status_reply(self, to_status, status, in_reply_to_id=None, media_ids=None,
spoiler_text=None, language=None, idempotency_key=None, content_type=None, sensitive=False, visibility=None, spoiler_text=None,
scheduled_at=None, poll=None, untag=False): language=None, idempotency_key=None, content_type=None,
scheduled_at=None, poll=None, untag=False):
""" """
Helper function - acts like status_post, but prepends the name of all Helper function - acts like status_post, but prepends the name of all
the users that are being replied to to the status text and retains the users that are being replied to to the status text and retains
@ -1623,6 +1624,11 @@ class Mastodon:
are replying to, removing every other mentioned user from the are replying to, removing every other mentioned user from the
conversation. conversation.
""" """
keyword_args = locals()
del keyword_args["self"]
del keyword_args["to_status"]
del keyword_args["untag"]
user_id = self.__get_logged_in_id() user_id = self.__get_logged_in_id()
# Determine users to mention # Determine users to mention
@ -1642,11 +1648,12 @@ class Mastodon:
visibility = to_status.visibility visibility = to_status.visibility
if spoiler_text == None and 'spoiler_text' in to_status: if spoiler_text == None and 'spoiler_text' in to_status:
spoiler_text = to_status.spoiler_text spoiler_text = to_status.spoiler_text
return self.status_post(status, in_reply_to_id = to_status.id, media_ids = media_ids, sensitive = sensitive, keyword_args["status"] = status
visibility = visibility, spoiler_text = spoiler_text, language = language, keyword_args["visibility"] = visibility
idempotency_key = idempotency_key, content_type = content_type, keyword_args["spoiler_text"] = spoiler_text
scheduled_at = scheduled_at, poll = poll) keyword_args["in_reply_to_id"] = to_status.id
return self.status_post(**keyword_args)
@api_version("2.8.0", "2.8.0", __DICT_VERSION_POLL) @api_version("2.8.0", "2.8.0", __DICT_VERSION_POLL)
def make_poll(self, options, expires_in, multiple=False, hide_totals=False): def make_poll(self, options, expires_in, multiple=False, hide_totals=False):