This commit is contained in:
parent
e60ae30668
commit
2b744a7cf8
21
main.py
21
main.py
@ -177,12 +177,21 @@ def update_address():
|
|||||||
if 'address' not in r.json():
|
if 'address' not in r.json():
|
||||||
print("Error: " + r.text,flush=True)
|
print("Error: " + r.text,flush=True)
|
||||||
# Send alert via discord
|
# Send alert via discord
|
||||||
webhook = os.getenv('webhook')
|
url = os.getenv('discord_webhook')
|
||||||
if webhook != None:
|
if url == None:
|
||||||
payload = {
|
return "No webhook set"
|
||||||
"content": "Error: " + r.text
|
|
||||||
}
|
payload = {
|
||||||
r = requests.post(webhook, data=json.dumps(payload), headers=headers)
|
"content": "NB cookie has expired\n@everyone"
|
||||||
|
}
|
||||||
|
response = requests.post(url, data=json.dumps(payload), headers={'Content-Type': 'application/json'})
|
||||||
|
|
||||||
|
# Check if the message was sent successfully
|
||||||
|
if response.status_code == 204:
|
||||||
|
print("Message sent successfully!")
|
||||||
|
else:
|
||||||
|
print(f"Failed to send message. Status code: {response.status_code}")
|
||||||
|
print(response.text)
|
||||||
return
|
return
|
||||||
|
|
||||||
address = r.json()['address']
|
address = r.json()['address']
|
||||||
|
Loading…
Reference in New Issue
Block a user