Created
April 22, 2017 15:10
-
-
Save joachimesque/45b862500a5470294720db4a98f81781 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# Comment faire un bot ? | |
# C'est simple! | |
# D'abord on installe Mastodon.py, on crée l'app et on s'authentifie | |
# sur le compte voulu. Attention, utilisez bien l'argument `api_base_url` | |
# pour vous connecter à la bonne instance. Sinon c'est mastodon.social. | |
# Ensuite on install ephem et on télécharge le fichier revolcal.py | |
# Ce script doit être situé dans le même dossier que revolcal.py. | |
# Mastodon.py : https://github.com/halcy/Mastodon.py | |
# sudo pip install Mastodon.py | |
# ephem : http://rhodesmill.org/pyephem/ | |
# sudo pip install ephem | |
# Revolcal : https://github.com/Nimlar/revolcal | |
# wget https://raw.githubusercontent.com/Nimlar/revolcal/master/revolcal.py | |
from mastodon import Mastodon | |
import revolcal | |
date = revolcal.RDate.today() | |
#print("Bonjour Citoyen, aujourd’hui nous somme le {:%rA %rd %rB de l’an %rY (%ry)}".format(date)) | |
mastodon = Mastodon( | |
client_id = 'revolcal_bot_clientcred.txt', | |
access_token = 'revolcal_bot_usercred.txt', | |
api_base_url = 'https://boitam.eu' | |
) | |
mastodon.toot("Nous sommes aujourd’hui le {:%rA %rd %rB de l’an %rY (%ry)\nNous célébrons %rf\n\n%rF}".format(date)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment