vollmond/bot/bot.py

23 lines
559 B
Python
Raw Normal View History

2024-11-01 11:00:09 +00:00
import moon
2024-08-28 09:24:18 +00:00
from mastodon import Mastodon
from pytz import timezone
from datetime import datetime
2024-08-28 09:24:18 +00:00
# Set up Mastodon
mastodon = Mastodon(
access_token = 'testtoken.secret',
# api_base_url = 'https://fnordon.de/'
api_base_url = 'https://mastodon.wazongtest.de/'
)
tz = timezone('Europe/Berlin')
now = datetime.now().astimezone(tz)
2024-08-28 09:24:18 +00:00
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
print(moon_text)
mastodon.status_post(moon_text, visibility='unlisted')
2024-08-28 09:24:18 +00:00
me = mastodon.me()
print(mastodon.account_statuses(me['id'])[0])