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
This commit is contained in:
sirpiglr 2025-12-03 03:37:28 +00:00
commit e649bd29b7

View file

@ -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;
}