vollmond/bot/bot.py

26 lines
536 B
Python

import datetime
import moon
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+=moon.moon_phase_as_text(now)
moon_text+="\n"
moon_text+=moon.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])