vollmond/bot/bot.py

23 lines
559 B
Python

import moon
from mastodon import Mastodon
from pytz import timezone
from datetime import datetime
# 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)
moon_text="Aktuelle Mondphase:\n"
moon_text+=moon.moon_phase_as_text(now)
print(moon_text)
mastodon.status_post(moon_text, visibility='unlisted')
me = mastodon.me()
print(mastodon.account_statuses(me['id'])[0])