initial
This commit is contained in:
commit
390becef63
4
.nova/Configuration.json
Normal file
4
.nova/Configuration.json
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"workspace.color" : 2,
|
||||||
|
"workspace.name" : "release tracker bot"
|
||||||
|
}
|
13
README.md
Normal file
13
README.md
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# fedi platform release bot
|
||||||
|
|
||||||
|
this program will run at a pre-defined interval to check for releases on the following platform repositories:
|
||||||
|
|
||||||
|
- mastodon
|
||||||
|
- firefish
|
||||||
|
- hometown
|
||||||
|
- akkoma
|
||||||
|
- gotosocial
|
||||||
|
|
||||||
|
other repositories can and will be added later.
|
||||||
|
|
||||||
|
once a new release is discovered, the link and title will be posted to discord in a channel that can be subscribed to from other places.
|
40
main.py
Normal file
40
main.py
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
import dotenv
|
||||||
|
import requests
|
||||||
|
from discord import SyncWebhook
|
||||||
|
from datetime import datetime as dt
|
||||||
|
|
||||||
|
# initialise variables
|
||||||
|
new_ts = dt.now()
|
||||||
|
old_ts = ''
|
||||||
|
|
||||||
|
# read in old timestamp if it exists
|
||||||
|
try:
|
||||||
|
old_ts = open('last_check','r').read()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
# load in the relevant .env variables
|
||||||
|
dotenv.load_dotenv()
|
||||||
|
conf = dotenv.dotenv_valules()
|
||||||
|
|
||||||
|
# list with urls to check
|
||||||
|
the_urls = [
|
||||||
|
'https://github.com/mastodon/mastodon/releases.atom',
|
||||||
|
'https://github.com/hometown-fork/hometown/releases.atom',
|
||||||
|
'https://git.joinfirefish.org/firefish/firefish/-/releases',
|
||||||
|
'https://akkoma.dev/AkkomaGang/akkoma/releases',
|
||||||
|
'https://github.com/superseriousbusiness/gotosocial/releases'
|
||||||
|
]
|
||||||
|
|
||||||
|
discord_user = conf['DISCORD_USERNAME']
|
||||||
|
dicord_webhook_url = conf['DISCORD_WEBHOOK_TEST']
|
||||||
|
webhook = SyncWebhook.from_url(conf['DISCORD_WEBHOOK_TEST'])
|
||||||
|
|
||||||
|
# test the last release date against the last check date:
|
||||||
|
# if old_ts.rstrip() != '' and {{release_date}} > old_ts.rstrip():
|
||||||
|
# post
|
||||||
|
# else:
|
||||||
|
# break
|
||||||
|
|
||||||
|
# write out current check timestamp to file for next check.
|
||||||
|
with open('last_check','w') as last_check:
|
||||||
|
print(ts.year + ts.month + ts.day + ts.hour + ts.minute + ts.second, file=last_check)
|
Loading…
Reference in New Issue
Block a user