
Security News
npm Adopts OIDC for Trusted Publishing in CI/CD Workflows
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
discord-chat-filter
Advanced tools
Module to filter the chat of a discord channel.
Chat Filter
const { ChatFilter } = require("discord-chat-filter") // Requiring the package
const chatFilter = new ChatFilter(message.content) // Create the chat filter
filterBadWord(['f*ck', 'sh*t']) // => If a member types 'f*ck' or 'sh*t', it will return true
filterLink() // => If a member sends a link, it will return true
filterMention() // => If a member mentions (@everyone, @here, @etc) it will return true
filterCaps() // => If a member sends a lot of caps, it will return true
const Discord = require('discord.js'); // Requiring Discord
const intents = new Discord.Intents(); // Intents => Message.content intent is required
const client = new Discord.Client({ intents: 32767 }); // Bot
client.on('ready', async () => {
console.log(`${client.user.username} is online`)
})
client.on('messageCreate', async (message) => { // Event emitted when a message is created
const { ChatFilter } = require('discord-chat-filter'); // Requiring the package
const chatFilter = new ChatFilter(message.content); // Creating the Chat Filter
if (message.author.bot) return; // Bot messages are not taken
if (chatFilter.filterBadWord(['f*ck', 'sh*t'])) { // Using the filterBadWord() Method
message.delete() // Delete the message
message.channel.send('No Badwords.') // Send a warning message
};
if (chatFilter.filterLink()) { // Using the filterLink() Method
message.delete() // Delete the message
message.channel.send('No Links.') // Send a warning message
};
if (chatFilter.filterMention()) { // Using the filterMention() Method
message.delete() // Delete the message
message.channel.send('No Mentions.') // Send a warning message
};
if (chatFilter.filterCaps()) { // Using the filterCaps() Method
message.delete() // Delete the message
message.channel.send('Too many caps.') // Send a warning message
};
});
client.login('YOUR TOKEN')
FAQs
Module to filter the chat of a discord channel.
The npm package discord-chat-filter receives a total of 7 weekly downloads. As such, discord-chat-filter popularity was classified as not popular.
We found that discord-chat-filter demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.