Question: don’t now what I’m doing wrong
Repl link:
import discord
import requests
import asyncio
client = discord.Client()
@client.event
async def on_ready():
print(f'We have logged in as {client.user}')
async def check_website():
url = "https://www.servicepulse.org/"
channel_id =
1209508594156965908
# Replace with your channel ID
channel = client.get_channel(channel_id)
while True:
try:
response = requests.get(url)
if response.status_code == 200:
await channel.send(f"🟢 {url} is up and running!")
else:
await channel.send(f"🔴 {url} is down! Status code: {response.status_code}")
except Exception as e:
await channel.send(f"❌ Error checking {url}: {e}")
await asyncio.sleep(60) # Check every 60 seconds
client.loop.create_task(check_website())
client.run('REDACTED - CHANGE ASAP')