vollmond/bot/bot.py

26 lines
536 B
Python
Raw Normal View History

2024-08-28 09:24:18 +00:00
import datetime
2024-11-01 11:00:09 +00:00
import moon
2024-08-28 09:24:18 +00:00
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"
2024-11-01 11:00:09 +00:00
moon_text+=moon.moon_phase_as_text(now)
2024-08-28 09:24:18 +00:00
moon_text+="\n"
2024-11-01 11:00:09 +00:00
moon_text+=moon.till_next_full_as_text(now)
2024-08-28 09:24:18 +00:00
print(moon_text)
mastodon.status_post(moon_text)
me = mastodon.me()
print(me['id'])
print(mastodon.account_statuses(me['id'])[0])