fix: racoon command should work now
Build and publish ich_iel bot / build (push) Successful in 1m29s

This commit is contained in:
2026-04-25 17:14:25 +02:00
parent f0729f43c9
commit 63972faa63
+2 -6
View File
@@ -170,17 +170,13 @@ async def racoon(message):
if response.status_code != 200: if response.status_code != 200:
await message.channel.send("Failed to fetch racoon image") await message.channel.send("Failed to fetch racoon image")
return return
match = re.match(r"data:image/(\w+);base64,(.+)", response.text.strip()) _, _, payload = response.text.strip().partition(",")
if not match:
await message.channel.send("Could not fetch racoon image")
return
ext, payload = match.group(1), match.group(2)
try: try:
image_bytes = base64.b64decode(payload) image_bytes = base64.b64decode(payload)
except (ValueError, base64.binascii.Error): except (ValueError, base64.binascii.Error):
await message.channel.send("Could not decode racoon image") await message.channel.send("Could not decode racoon image")
return return
await message.channel.send(file=fluxer.File(image_bytes, filename=f"racoon.{ext}")) await message.channel.send(file=fluxer.File(image_bytes, filename="racoon.jpg"))
async def post_reddit(): async def post_reddit():
subreddit = os.getenv("SUBREDDIT", "ich_iel") subreddit = os.getenv("SUBREDDIT", "ich_iel")