MastodonPostScheduler

MastodonPostScheduler 是一个命令行工具,用于在 Mastodon 实例上安排帖子发布时间。

用法

❯ cat post.json
{
    "text": "This is a scheduled test post.",
    "scheduledAt": "2025-02-15 15:00",
}
❯ mastodon-post-scheduler schedule --instance mas.to --token $MASTODON_ACCESS_TOKEN --input post.json
Scheduling post at 2025-02-15 14:00:00 +0000 on https://mas.to ...
Post scheduled, id: 28329
❯ mastodon-post-scheduler list --instance mas.to --token $MASTODON_ACCESS_TOKEN
Listing scheduled posts on https://mas.to ...
scheduled at                |   id
---------------------------------------
2025-02-15 14:00:00 +0000   |   28329
❯ mastodon-post-scheduler delete --instance mas.to --token $MASTODON_ACCESS_TOKEN --id 28329
Deleting post '28329' posts on https://mas.to ...
Post '28329' deleted.

帖子格式

用于 --input 参数的 JSON 文件格式如下:

struct Post {
    var text: String
    var scheduledAt: Date
    var language: String?
}

日期格式为 yyyy-MM-dd HH:mm。日期将使用您所在地区的时区进行解析。

安装

Mint

您可以使用 Mint 安装 MastodonPostScheduler

mint install finestructure/MastodonPostScheduler

Make

您也可以通过包含的 Makefile 构建并安装 MastodonPostScheduler,方法是运行

make install

这会将二进制文件 arena 复制到 /usr/local/bin。