Skip to content

Conversation

@ChrisCh7
Copy link
Contributor

Resolves #310

Overview

  • Add AntiSpamHandler
    When a non-bot user posts a message in the anti-spam channel, the bot will ban the user and remove their last 1h of message history, then post in the logs channel about this.
  • Add tests for AntiSpamHandler (AntiSpamHandlerTest)
  • Add ANTISPAM_CHANNEL_ID in config.json

Copy link
Member

@LamboCreeper LamboCreeper left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this, going to be a big help. Just one tiny change regarding logging.


const logsChannel = await message.guild.channels.fetch(logsChannelId) as TextChannel;

await logsChannel.send(`User ${member.user.username} (\`${member.id}\`) was banned for posting in <#${antiSpamChannelId}>. Their recent messages have been deleted.\nPosted message content:\n\`\`\`\n${message.content}\n\`\`\``);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather it didn't log the message content - it'll just clog up the logs channel with annoying spam. Not too fussed about seeing what the messages were.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the logging of message content.

@LamboCreeper LamboCreeper merged commit 68bdd58 into codesupport:master Sep 15, 2025
3 checks passed
@ChrisCh7 ChrisCh7 deleted the feature/antispam branch September 15, 2025 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Anti-spam channel and handler

2 participants