32 lines
671 B
Python
32 lines
671 B
Python
|
from mastodon import Mastodon
|
||
|
from flask import request
|
||
|
from core import config
|
||
|
from core.logger import logging
|
||
|
|
||
|
|
||
|
logging.debug("Fedi started")
|
||
|
|
||
|
|
||
|
# I don't like typing toot
|
||
|
def post(contents):
|
||
|
return fedi.status_post(contents, visibility="unlisted")
|
||
|
|
||
|
|
||
|
def parse_webhook(repo):
|
||
|
print(repo)
|
||
|
data = request.json["commits"][0]
|
||
|
print(data)
|
||
|
message = "[{}] \"{}\"\n{}".format(
|
||
|
#message = "{}: \"{}\" {}".format(
|
||
|
#data["author"]["name"],
|
||
|
repo,
|
||
|
data["message"].strip(),
|
||
|
data["url"],
|
||
|
)
|
||
|
post(message)
|
||
|
|
||
|
fedi = Mastodon(
|
||
|
api_base_url = config["fedi"]["BaseURL"],
|
||
|
access_token = config["fedi"]["AccessToken"],
|
||
|
)
|