Skip to content

Instantly share code, notes, and snippets.

@joachimesque
Created April 22, 2017 15:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joachimesque/45b862500a5470294720db4a98f81781 to your computer and use it in GitHub Desktop.
Save joachimesque/45b862500a5470294720db4a98f81781 to your computer and use it in GitHub Desktop.
#!/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