Last active
June 21, 2023 07:12
-
-
Save ywindish/a96197b34aa55e0bea35045b4256f4fd to your computer and use it in GitHub Desktop.
Mastodonに毎日ランダムな時間で予約投稿するbot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# crontab とかで 0:00 に実行するといい感じ | |
# encoding: utf-8 | |
require 'mastodon' | |
require 'date' | |
message = "らんだむに投稿されるよ" | |
url = "https://mastodon.example.com" | |
token = 'xxxxxx' | |
client = Mastodon::REST::Client.new(base_url: url, bearer_token: token) | |
scheduled_at = "#{Date.today().strftime('%Y-%m-%d')}T#{rand(23)}:#{rand(59)}+09:00" | |
client.create_status(message, { scheduled_at: scheduled_at }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment