vollmond/bot/testbot.py

26 lines
551 B
Python
Raw Normal View History

2024-08-28 09:24:18 +00:00
import datetime
import testmoon2
from mastodon import Mastodon
# Set up Mastodon
mastodon = Mastodon(
access_token = 'testtoken.secret',
# api_base_url = 'https://fnordon.de/'
api_base_url = 'https://mastodon.wazongtest.de/'
)
now = datetime.datetime.now()
moon_text="Aktuelle Mondphase:\n"
moon_text+=testmoon2.moon_phase_as_text(now)
moon_text+="\n"
moon_text+=testmoon2.till_next_full_as_text(now)
print(moon_text)
mastodon.status_post(moon_text)
me = mastodon.me()
print(me['id'])
print(mastodon.account_statuses(me['id'])[0])