New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

discord.js-message-replace

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

discord.js-message-replace

This npm package provides a function to replace words in a message, specifically designed for use in Discord bots.

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

Discord.js Message Replace

This npm package provides a function to replace words in a message, specifically designed for use in Discord bots.

Installation

You can install this package using npm:

npm install discord.js-message-replace

Example

const { replaceWords, replacements } = require('discord.js-message-replace');

const channelsToMonitor = [
    "", // channelID
    "" // channelID
];

// you can add also too many channels.

client.on('messageCreate', async (message) => {
    if (message.author.bot) return; // ignore bots
    if (channelsToMonitor.includes(message.channel.id)) {
        try {
            const replacedContent = replaceWords(message.content, replacements); // replace message & copy it
            message.delete() // delete member message
            await message.channel.send(`${replacedContent}\n\n||@here||`); // send message after replace.
        } catch (error) {
            console.error('Error:', error);
        }
    }
});

Credits

  • Developed by AmtiXDev.

License

This project is licensed under the MIT License.

Keywords

replace

FAQs

Package last updated on 28 Mar 2024

Did you know?

Socket

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.

Install

Related posts