You need to write a script that automates the process of updating your Dyn DNS records. The script should find the current status of the records, update them if necessary, and then notify the relevant parties (Telegram, Discord, and another DM) about the changes.
Here is a sample Python script that you can use as a starting point:
``
python
import sys
import time
print(" DynDNS Update Script starts ")
# Get current DNS record status
response = requests.get('https://api dyn .dns.com/update_record')
if 'STATUS:NO_CHANGE' in response.text:
print(" WARNING: No change in DNS record")
else:
print(response.text)
while True:
# Check every minute to see if there's an update
time.sleep(60)
# Get current DNS record status again
response = requests.get('https://api dyn .dns.com/update_record')
if 'STATUS:NO_CHANGE' in response.text:
print(" WARNING: No change in Dyn DNS records")
else:
print(response.text)
# Notify Telegram party
for user in ['admin', 'user1', 'user2']:
url = f'https://api telegram.com/api/bot/{sys.argv[1]}@your_bot_user_id/updates.json'
headers = {'Authorization': Bearer YOUR_API_KEY
}
data = {'message': {
'chat_id': f-'1003980922525' if user == "admin" else '-1003980922525',
'text': 'Dyn DNS Update: '
}}
response = requests.POST(url, headers=headers, json=data)
print(f'Target {user} with updated response')
# Notify Discord and another DM
for target in ['1511697499654459422', '1812605657']:
if sys.argv[1] != "hermes":
target_url = f'https://api discord.com/api/memes/bot/{sys.argv[1]}@your_bot_user_id/updates.json'
headers = {'Authorization': Bearer YOUR_API_KEY
}
data = {'message': {
'embeds': [
{'title': 'Dyn DNS Update',
'description': 'Current status: '
}
]
}}
response = requests.POST(target_url, headers=headers, json=data)
print(f'Target {target} with updated response')
print(" DynDNS Update Script ends ")
`
Note that you need to replace the placeholders (e.g. sys.argv[1]` ) with your actual bot token and user ID.
Please be aware that this is a simple script and may not cover all edge cases or potential issues. You should always test it thoroughly before running it in production.