savepoint
This commit is contained in:
@@ -7,9 +7,9 @@ jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v5
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v3
|
||||
uses: actions/setup-python@v6
|
||||
with:
|
||||
python-version: "3.13"
|
||||
- name: Install dependencies
|
||||
|
@@ -72,3 +72,7 @@ wikipedia_token = getenv('WIKIPEDIA_ACCESS_TOKEN')
|
||||
|
||||
# AP API ENDPOINTS
|
||||
endpoints = Munch(loads('{"status": "/api/v1/statuses", "media": "/api/v1/media", "timeline": "/api/v1/timelines/public"}'))
|
||||
|
||||
# Discord webhook
|
||||
discord_hook = getenv('DISCORD_WEBHOOK_URL')
|
||||
|
||||
|
34
release_check_class.py
Normal file
34
release_check_class.py
Normal file
@@ -0,0 +1,34 @@
|
||||
from requests import post
|
||||
from os import getenv
|
||||
|
||||
class Notify:
|
||||
def __init__(self, message, priority):
|
||||
self.discord_hook = getenv('DISCORD_WEBHOOK_URL')
|
||||
self.telegram_endpoint = 'https://api.telegram.org'
|
||||
self.telegram_bot = getenv('TELEGRAM_BOT_TOKEN')
|
||||
self.telegram_user = getenv('TELEGRAM_USER_TOKEN')
|
||||
self.pushover_endpoint = getenv('PUSHOVER_ENDPOINT')
|
||||
self.pushover_user_token = getenv('PUSHOVER_USER_TOKEN')
|
||||
self.pushover_channel_token = getenv('PUSHOVER_TEST_TOKEN')
|
||||
self.message = message
|
||||
self.priority = priority
|
||||
|
||||
def telegram_send(self):
|
||||
url = f'{self.telegram_endpoint}/bot{self.telegram_bot}/sendMessage'
|
||||
response = post(url=url,data={'chat_id': self.telegram_user, 'text': self.message})
|
||||
|
||||
def pushover_send(self):
|
||||
response = post(self.pushover_endpoint, data={'token': self.pushover_channel_token, 'user': self.pushover_user_token, 'message': self.message, 'priority': self.priority})
|
||||
|
||||
def discord_send(self):
|
||||
response = post(self.discord_hook, data={'content': self.message})
|
||||
|
||||
|
||||
def send_all(self):
|
||||
if self.telegram_bot:
|
||||
self.telegram_send()
|
||||
if self.discord_hook:
|
||||
self.discord_send()
|
||||
if self.pushover_user_token:
|
||||
self.pushover_send()
|
||||
|
Reference in New Issue
Block a user