3 Commits

Author SHA1 Message Date
Michelle 36a61e978b change logging level from info to debug for image post
Build and publish ich_iel bot / build (push) Successful in 1m36s
Build and publish ich_iel bot / build (release) Successful in 1m39s
2026-04-18 13:27:58 +02:00
Michelle 6e145fbf56 update version command to include source code link
Build and publish ich_iel bot / build (push) Successful in 1m38s
2026-04-18 13:07:55 +02:00
Michelle 2adec3b76c update installation instructions and compose file
Build and publish ich_iel bot / build (push) Successful in 1m39s
2026-04-18 13:02:45 +02:00
3 changed files with 10 additions and 6 deletions
+4 -1
View File
@@ -4,12 +4,15 @@ A bot for Fluxer which posts a post from ich_iel every hour.
## Installation: ## Installation:
Clone repo:
``` ```
git clone https://git.scrunkly.cat/Michelle/ich_iel-Bot.git git clone https://git.scrunkly.cat/Michelle/ich_iel-Bot.git
``` ```
Check .env file and add your FLUXER_TOKEN.
Then start the container:
``` ```
docker compose build
docker compose up -d docker compose up -d
``` ```
+2 -1
View File
@@ -1,6 +1,7 @@
services: services:
ich_iel-bot: ich_iel-bot:
build: . image: git.scrunkly.cat/michelle/ich_iel-bot:latest
restart: unless-stopped
volumes: volumes:
- ./data:/app/data - ./data:/app/data
env_file: ".env" env_file: ".env"
+4 -4
View File
@@ -62,7 +62,7 @@ async def get_latest_post(subreddit):
for child in data["data"]["children"]: for child in data["data"]["children"]:
post = child["data"] post = child["data"]
if post.get("post_hint") == "image" and post.get("url", "").endswith((".jpg", ".png", ".jpeg", ".gif")): if post.get("post_hint") == "image" and post.get("url", "").endswith((".jpg", ".png", ".jpeg", ".gif")):
logging.info(f"Found image post: {post['title']} - {post['url']}") logging.debug(f"Found image post: {post['title']} - {post['url']}")
posts.append((post["title"], post["url"])) posts.append((post["title"], post["url"]))
return posts return posts
except (KeyError, json.JSONDecodeError): except (KeyError, json.JSONDecodeError):
@@ -118,7 +118,7 @@ async def setChannel(message):
@bot.command() @bot.command()
async def version(message): async def version(message):
await message.channel.send("Version 0.4 is running") await message.channel.send("Version 0.4.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()
@@ -156,7 +156,7 @@ async def post_reddit():
post_id = post_id_match.group(1) post_id = post_id_match.group(1)
is_posted = cur.execute("SELECT post_id FROM posted WHERE guild_id = ? AND post_id = ?", (guild_id, post_id)).fetchone() is_posted = cur.execute("SELECT post_id FROM posted WHERE guild_id = ? AND post_id = ?", (guild_id, post_id)).fetchone()
if is_posted: if is_posted:
logging.info(f"Post {post_id} already posted in guild {guild_id}, skipping.") logging.debug(f"Post {post_id} already posted in guild {guild_id}, skipping.")
continue continue
try: try:
channel = await bot.fetch_channel(int(channel_id)) channel = await bot.fetch_channel(int(channel_id))
@@ -176,7 +176,7 @@ async def post_reddit():
logging.warning(f"Channel {channel_id} not found for guild {guild_id}") logging.warning(f"Channel {channel_id} not found for guild {guild_id}")
except Exception as e: except Exception as e:
logging.error(f"Error sending to channel {channel_id}: {e}") logging.error(f"Error sending to channel {channel_id}: {e}")
logging.info("All posts processed.") logging.debug("All posts processed.")
except sqlite3.Error as e: except sqlite3.Error as e:
logging.error(f"Database error: {e}") logging.error(f"Database error: {e}")