6 Commits
Author SHA1 Message Date
Michelle dbad01da5c Merge pull request 'adding fops alias for fox command (hopefully)' (#1) from Amy/ich_iel-Bot:amy-patch-1 into master
Build and publish ich_iel bot / build (push) Successful in 5m58s
Reviewed-on: #1
2026-05-17 14:17:11 +02:00
Amy ce8e09f4ab adding fops alias for fox command (hopefully) 2026-05-17 14:15:27 +02:00
Michelle 2279ae700c update version to 0.6.2
Build and publish ich_iel bot / build (push) Has been cancelled
Build and publish ich_iel bot / build (release) Successful in 5m58s
2026-05-13 13:24:24 +02:00
Michelle 12d556f0c4 implement bnuy-api to bnuy command
Build and publish ich_iel bot / build (push) Successful in 5m55s
2026-05-13 13:15:52 +02:00
Michelle 7b09d1a348 update version to 0.6.1
Build and publish ich_iel bot / build (release) Successful in 6m3s
Build and publish ich_iel bot / build (push) Has been cancelled
2026-05-08 20:53:12 +02:00
Michelle 01e5208cba add bnuy command
Build and publish ich_iel bot / build (push) Successful in 6m2s
2026-05-08 20:46:10 +02:00
+36 -2
View File
@@ -55,7 +55,7 @@ async def post_reddit_periodically():
async def get_latest_post(subreddit): async def get_latest_post(subreddit):
post_limit = os.getenv("POST_LIMIT", 20) post_limit = os.getenv("POST_LIMIT", 20)
url = f"https://www.reddit.com/r/{subreddit}/hot.rss?limit={post_limit}" url = f"https://www.reddit.com/r/{subreddit}/hot.rss?limit={post_limit}"
headers = {"User-Agent": "Mozilla/5.0 (compatible; ich_iel-Bot/0.6.0)"} headers = {"User-Agent": "Mozilla/5.0 (compatible; ich_iel-Bot/0.6.2)"}
response = requests.get(url, headers=headers) response = requests.get(url, headers=headers)
if response.status_code != 200: if response.status_code != 200:
logging.error(f"Failed to fetch RSS feed: {response.status_code}") logging.error(f"Failed to fetch RSS feed: {response.status_code}")
@@ -121,7 +121,7 @@ async def setChannel(message):
@bot.command() @bot.command()
async def version(message): async def version(message):
await message.channel.send("Version 0.6.0 is running\nSource code: https://github.com/michelleDeko/ich_iel-bot") await message.channel.send("Version 0.6.2 is running\nSource code: https://github.com/michelleDeko/ich_iel-bot")
# the cat bot died, so i wanted to add this command to this bot # the cat bot died, so i wanted to add this command to this bot
@bot.command() @bot.command()
@@ -150,6 +150,7 @@ async def dog(message):
await message.channel.send("Failed to fetch dog image") await message.channel.send("Failed to fetch dog image")
@bot.command() @bot.command()
@bot.command("fops")
async def fox(message): async def fox(message):
response = requests.get("https://randomfox.ca/floof/") response = requests.get("https://randomfox.ca/floof/")
if response.status_code == 200: if response.status_code == 200:
@@ -176,6 +177,39 @@ async def racoon(message):
return return
await message.channel.send(file=fluxer.File(image_bytes, filename="racoon.jpg")) await message.channel.send(file=fluxer.File(image_bytes, filename="racoon.jpg"))
# i just watched beastars and i realised that this bot needs a bnuy command
# maybe I will switch the API later since this one seems to only have gifs
@bot.command()
async def bnuy(message):
urls = random.choice([
"https://api.bunnies.io/v2/loop/random/?media=gif,png",
"https://bnuy-api.scrunkly.cat/random"
])
async with aiohttp.ClientSession() as session:
async with session.get(urls) as response:
if response.status != 200:
await message.channel.send("Failed to fetch image of a bunny")
return
data = await response.json()
image_url = (
data.get("media", {}).get("gif")
or data.get("media", {}).get("png")
or data.get("url")
)
if not image_url:
await message.channel.send("Failed to fetch image of a bunny")
return
async with session.get(image_url) as image_response:
if image_response.status != 200:
await message.channel.send("Failed to fetch image of a bunny")
return
image_bytes = await image_response.read()
content_type = image_response.headers.get("Content-Type", "").split(";")[0]
file_ext = content_type.split("/")[-1] if content_type.startswith("image/") else "jpg"
await message.channel.send(file=fluxer.File(image_bytes, filename=f"bnuy.{file_ext}"))
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)