Hey everyone! I’m super excited to share a little project I’ve been working on. I built a Discord bot that alerts me when new server auctions come up on Hetzner. It has really helped me catch some great deals!
Here’s a quick summary of how it functions:
import discord
import requests
def fetch_auctions():
response = requests.get('https://api.hetzner.com/auctions')
if response.status_code == 200:
auctions = response.json()['auctions']
return auctions
return None
async def notify_channel(channel, auction):
msg = f'New auction: {auction["server_type"]} available for €{auction["price"]}'
await channel.send(msg)
client = discord.Client()
@client.event
async def on_ready():
channel = client.get_channel(CHANNEL_ID)
while True:
auctions = fetch_auctions()
if auctions:
for auction in auctions:
await notify_channel(channel, auction)
await asyncio.sleep(300) # Check every 5 minutes
client.run('YOUR_BOT_TOKEN')
Has anyone else tried something similar? I’d really appreciate any suggestions to make it better.
Impressive work on the Hetzner auction alert system! I’ve been looking for something like this. A few thoughts to potentially enhance it:
Consider implementing rate limiting to avoid API abuse. You might also want to add error handling for network issues or API changes. Storing auction data locally could help track price trends over time.
Have you thought about extending it to other providers like OVH or Scaleway? Could be valuable for comparison shopping. Also, adding a way to automatically bid on auctions that meet certain criteria could be a game-changer.
Thanks for sharing the code. It’s given me some ideas to explore for my own projects.
thats pretty cool! i made somethin similar for ebay deals but never thought about server auctions. does it catch everything or just specific types? might be worth adding filters so u dont get spammed. also, have u considered using websockets instead of polling? could be more efficient. nice work tho!
Great initiative! I’ve been using a similar setup for DigitalOcean droplets, and it’s been a game-changer. One thing I found helpful was adding price thresholds. So, instead of getting pinged for every auction, I only get alerts for servers below a certain price point. Saves a lot of notification fatigue.
Also, I’d recommend implementing some basic caching. Store the IDs of auctions you’ve already notified about, so you don’t end up with duplicate alerts if the script hiccups or restarts. It’s a small change but makes the whole system more robust.
Have you considered expanding it to track when auctions are closing soon? That last-minute reminder has helped me snag some killer deals. Just a thought. Keep iterating on it!