Add option for scheduling tweets
This commit is contained in:
parent
0fd1d7d8b8
commit
7e0da50603
4 changed files with 17 additions and 1 deletions
|
@ -1,3 +1,8 @@
|
|||
0.28.0:
|
||||
date: TBA
|
||||
changes:
|
||||
- "Add `--scheduled-at` option to `toot post`, allows scheduling toots"
|
||||
|
||||
0.27.0:
|
||||
date: 2020-06-15
|
||||
changes:
|
||||
|
|
|
@ -92,6 +92,7 @@ def post_status(
|
|||
spoiler_text=None,
|
||||
in_reply_to_id=None,
|
||||
language=None,
|
||||
scheduled_at=None,
|
||||
):
|
||||
"""
|
||||
Posts a new status.
|
||||
|
@ -110,6 +111,7 @@ def post_status(
|
|||
'spoiler_text': spoiler_text,
|
||||
'in_reply_to_id': in_reply_to_id,
|
||||
'language': language,
|
||||
'scheduled_at': scheduled_at
|
||||
}, headers=headers).json()
|
||||
|
||||
|
||||
|
|
|
@ -114,9 +114,13 @@ def post(app, user, args):
|
|||
spoiler_text=args.spoiler_text,
|
||||
in_reply_to_id=args.reply_to,
|
||||
language=args.language,
|
||||
scheduled_at=args.scheduled_at,
|
||||
)
|
||||
|
||||
print_out("Toot posted: <green>{}</green>".format(response.get('url')))
|
||||
if "scheduled_at" in response:
|
||||
print_out("Toot scheduled for: <green>{}</green>".format(response["scheduled_at"]))
|
||||
else:
|
||||
print_out("Toot posted: <green>{}</green>".format(response.get('url')))
|
||||
|
||||
|
||||
def delete(app, user, args):
|
||||
|
|
|
@ -326,6 +326,11 @@ POST_COMMANDS = [
|
|||
"help": "Specify an editor to compose your toot, "
|
||||
"defaults to editor defined in $EDITOR env variable.",
|
||||
}),
|
||||
(["--scheduled-at"], {
|
||||
"type": str,
|
||||
"help": "ISO 8601 Datetime at which to schedule a status. Must "
|
||||
"be at least 5 minutes in the future.",
|
||||
}),
|
||||
],
|
||||
require_auth=True,
|
||||
),
|
||||
|
|
Loading…
Reference in a new issue