feat: add dog and fox commands
Build and publish ich_iel bot / build (push) Successful in 1m32s

This commit is contained in:
2026-04-25 16:39:23 +02:00
parent 4c874cbaa4
commit b9e1740e10
+25
View File
@@ -133,6 +133,31 @@ async def cat(message):
else: else:
await message.channel.send("Failed to fetch cat image") await message.channel.send("Failed to fetch cat image")
# i thought dogs and foxes would be nice to have too
@bot.command()
async def dog(message):
response = requests.get("https://dog.ceo/api/breeds/image/random")
if response.status_code == 200:
data = response.json()
if data and isinstance(data, list) and "url" in data[0]:
await message.channel.send(data[0]["url"])
else:
await message.channel.send("Could not fetch dog image")
else:
await message.channel.send("Failed to fetch dog image")
@bot.command()
async def fox(message):
response = requests.get("https://randomfox.ca/floof/")
if response.status_code == 200:
data = response.json()
if data and isinstance(data, list) and "url" in data[0]:
await message.channel.send(data[0]["url"])
else:
await message.channel.send("Could not fetch fox image")
else:
await message.channel.send("Failed to fetch fox image")
async def post_reddit(): async def post_reddit():
subreddit = os.getenv("SUBREDDIT", "ich_iel") subreddit = os.getenv("SUBREDDIT", "ich_iel")
posts = await get_latest_post(subreddit) posts = await get_latest_post(subreddit)