fix: use aiohttp for racoon command
Build and publish ich_iel bot / build (push) Successful in 1m29s

This commit is contained in:
2026-04-25 17:28:16 +02:00
parent 08778bf0a5
commit 90684ba27f
2 changed files with 6 additions and 9 deletions
+4 -8
View File
@@ -1,3 +1,4 @@
import aiohttp
import fluxer
import requests
import json
@@ -166,17 +167,12 @@ async def racoon(message):
"https://api.mapach.es/v1/meme",
"https://api.mapach.es/v1/coon"
])
response = requests.get(urls)
async with aiohttp.ClientSession() as session:
async with session.get(urls) as response:
image_bytes = await response.read()
if response.status_code != 200:
await message.channel.send("Failed to fetch racoon image")
return
_, _, payload = response.text.strip().partition(",")
try:
image_bytes = base64.b64decode(payload)
except (ValueError, base64.binascii.Error):
await message.channel.send("Could not decode racoon image")
logging.warning(f"Failed to decode base64 image data: {payload}")
return
await message.channel.send(file=fluxer.File(image_bytes, filename="racoon.jpg"))
async def post_reddit():
+2 -1
View File
@@ -1,4 +1,5 @@
fluxer.py
requests
asyncio
dotenv
dotenv
aiohttp