mirror of
https://github.com/michivonah/themepark-alerts.git
synced 2025-12-22 20:36:27 +01:00
add ability to load subscribed attractions from env
This commit is contained in:
parent
c8ca8e1362
commit
9201ffaa08
2 changed files with 6 additions and 2 deletions
|
|
@ -18,4 +18,6 @@ These environment variables are supported
|
||||||
| Variable | Description | Example |
|
| Variable | Description | Example |
|
||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
| DISCORD_WEBHOOK | The URL of your discord webhook | ``https://discord.com/api/webhooks/XXXXXXXXXXXXXX/YYYYYYYYYYYYYYYYYYYYYYYYY`` |
|
| DISCORD_WEBHOOK | The URL of your discord webhook | ``https://discord.com/api/webhooks/XXXXXXXXXXXXXX/YYYYYYYYYYYYYYYYYYYYYYYYY`` |
|
||||||
| SUBS | Your subscribed attractions with ID from wartezeiten.app API | ``"383533, 323530, 353030"`` |
|
| SUBS | Your subscribed attractions with ID from wartezeiten.app API | ``383533,323530,353030`` |
|
||||||
|
|
||||||
|
> Required enviromental variables: DISCORD_WEBHOOK, SUBS
|
||||||
4
main.py
4
main.py
|
|
@ -11,7 +11,7 @@ import time
|
||||||
load_dotenv()
|
load_dotenv()
|
||||||
|
|
||||||
# Global defintions
|
# Global defintions
|
||||||
subscribedAttractions = ["383533", "383530", "323530", "323030", "353030", "393030"]
|
subscribedAttractions = os.getenv('SUBS').split(",")
|
||||||
currentTimes = {}
|
currentTimes = {}
|
||||||
refreshTime = 30
|
refreshTime = 30
|
||||||
|
|
||||||
|
|
@ -20,6 +20,7 @@ def sendMessage(message):
|
||||||
webhookUrl = os.getenv('DISCORD_WEBHOOK')
|
webhookUrl = os.getenv('DISCORD_WEBHOOK')
|
||||||
webhook = DiscordWebhook(url=webhookUrl, content=message)
|
webhook = DiscordWebhook(url=webhookUrl, content=message)
|
||||||
response = webhook.execute()
|
response = webhook.execute()
|
||||||
|
return response
|
||||||
|
|
||||||
# Check for the current waiting times
|
# Check for the current waiting times
|
||||||
def checkTimes(subscribedAttractions):
|
def checkTimes(subscribedAttractions):
|
||||||
|
|
@ -48,6 +49,7 @@ def checkTimes(subscribedAttractions):
|
||||||
|
|
||||||
# Main Loop
|
# Main Loop
|
||||||
# Checks every 30 seconds for changes in the waiting times of the subscribed attractions
|
# Checks every 30 seconds for changes in the waiting times of the subscribed attractions
|
||||||
|
# If some attractions are closed the check will only be executed every 180 seconds
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
print("EP Waiting Time Alerting Tool")
|
print("EP Waiting Time Alerting Tool")
|
||||||
print("By Michi von Ah")
|
print("By Michi von Ah")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue