diff --git a/changelog.yaml b/changelog.yaml
index ee966d6..6892e52 100644
--- a/changelog.yaml
+++ b/changelog.yaml
@@ -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:
diff --git a/toot/api.py b/toot/api.py
index f268de2..27d8c9d 100644
--- a/toot/api.py
+++ b/toot/api.py
@@ -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()
diff --git a/toot/commands.py b/toot/commands.py
index e4f2020..c041ff9 100644
--- a/toot/commands.py
+++ b/toot/commands.py
@@ -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: {}".format(response.get('url')))
+ if "scheduled_at" in response:
+ print_out("Toot scheduled for: {}".format(response["scheduled_at"]))
+ else:
+ print_out("Toot posted: {}".format(response.get('url')))
def delete(app, user, args):
diff --git a/toot/console.py b/toot/console.py
index 3e95baa..5e88a52 100644
--- a/toot/console.py
+++ b/toot/console.py
@@ -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,
),