From d442a1cd5a0438985248c9d1107917f139463f77 Mon Sep 17 00:00:00 2001 From: sirpiglr <49359077-sirpiglr@users.noreply.replit.com> Date: Wed, 3 Dec 2025 03:37:28 +0000 Subject: [PATCH] Limit bot messages to specific channels to prevent unwanted syncing Add conditional logic to only sync messages from configured channels like main chat, announcements, and the feed channel, preventing all messages from being processed. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 9203795e-937a-4306-b81d-b4d5c78c240e Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: 1cbe8f4b-356c-4837-ace1-6973d0cbee0c Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/7c94b7a0-29c7-4f2e-94ef-44b2153872b7/9203795e-937a-4306-b81d-b4d5c78c240e/duiWnI1 Replit-Helium-Checkpoint-Created: true --- discord-bot/events/messageCreate.js | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/discord-bot/events/messageCreate.js b/discord-bot/events/messageCreate.js index e206978c..6cbd2b7d 100644 --- a/discord-bot/events/messageCreate.js +++ b/discord-bot/events/messageCreate.js @@ -307,6 +307,16 @@ module.exports = { if (message.author.bot) return; if (!message.content && message.attachments.size === 0) return; + // Debug: Log channel info for troubleshooting + const isMainChat = MAIN_CHAT_CHANNELS.includes(message.channelId); + const isAnnouncement = ANNOUNCEMENT_CHANNELS.includes(message.channelId); + const isFeedChannel = FEED_CHANNEL_ID && message.channelId === FEED_CHANNEL_ID; + + // Only log if the message is from a channel we care about + if (isMainChat || isAnnouncement || isFeedChannel) { + console.log(`[MessageCreate] Channel: ${message.channel.name} (${message.channelId}) | Main: ${isMainChat} | Announcement: ${isAnnouncement} | Feed: ${isFeedChannel}`); + } + // Check if this is an announcement to sync if ( ANNOUNCEMENT_CHANNELS.length > 0 && @@ -323,8 +333,15 @@ module.exports = { return handleMainChatSync(message); } - // Check if this is in the feed channel (for user-generated posts) - if (FEED_CHANNEL_ID && message.channelId !== FEED_CHANNEL_ID) { + // If no specific channels are configured for sync, exit early + // This prevents syncing ALL messages from every channel + if (!FEED_CHANNEL_ID) { + // No feed channel configured - only process main chat and announcement channels + return; + } + + // Check if this is in the feed channel (for user-generated posts with linked accounts) + if (message.channelId !== FEED_CHANNEL_ID) { return; }