2 Commits
Author SHA1 Message Date
Michelle 7cf83daf0b update version
Build and publish ich_iel bot / build (push) Successful in 6m4s
Build and publish ich_iel bot / build (release) Successful in 6m0s
2026-05-28 10:46:19 +02:00
Michelle 7811ee2888 disable embed from fluxer
Build and publish ich_iel bot / build (push) Successful in 6m5s
2026-05-28 10:37:49 +02:00
+3 -3
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/1.0.0)"} headers = {"User-Agent": "Mozilla/5.0 (compatible; ich_iel-Bot/1.0.1)"}
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 1.0.0 is running\nSource code: https://github.com/michelleDeko/ich_iel-bot") await message.channel.send("Version 1.0.1 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()
@@ -278,7 +278,7 @@ async def post_reddit():
content_type = response.headers.get("Content-Type", "").split(";")[0] content_type = response.headers.get("Content-Type", "").split(";")[0]
file_ext = content_type.split("/")[-1] if content_type.startswith("image/") else "jpg" file_ext = content_type.split("/")[-1] if content_type.startswith("image/") else "jpg"
await channel.send( await channel.send(
content=f"{title}\nOriginal post: {image_url}", content=f"{title}\nOriginal post: <{image_url}>",
file=fluxer.File(image_bytes, filename=f"{post_id}.{file_ext}") file=fluxer.File(image_bytes, filename=f"{post_id}.{file_ext}")
) )
cur.execute("INSERT OR REPLACE INTO posted (guild_id, post_id) VALUES (?, ?)", (guild_id, post_id)) cur.execute("INSERT OR REPLACE INTO posted (guild_id, post_id) VALUES (?, ?)", (guild_id, post_id))