Home - ThatsLiamS/discord.js-ghost-ping GitHub Wiki
- Open the CMD / Shell / Terminal
- Naviagate to the project's Root Directory
- Run either command:
$ npm install discord.js-ghost-ping
$ yarn add discord.js-ghost-ping
- Import the package
const GhostPing = require('discord.js-ghost-ping');
import GhostPing from 'discord.js-ghost-ping';
- The package requires two detectors in separate DiscordJs events to work correctly because ghost pings can occur in deleted and updated/edited messages. The
messageDelete
andmessageUpdate
.
client.on('messageDelete', message => {
...
})
client.on('messageUpdate', (oldMessage, newMessage) => {
...
})
- Add the detector
The Detector Function requires 2 (or 3) parameters. The first is the DiscordJS Event (messageDelete
or messageUpdate
). The second is the Discord Message object (message
or oldMessage
, newMessage
).
client.on('messageDelete', message => {
const result = GhostPing('messageDelete', message);
/* Use result to send your own alert */
message.channel.send({ content: `You have been **ghost pinged** - ${result.mentions}` });
})
{
author: <Object> | Discord User
channel: <Object> | Discord TextChannel
guild: <Object> | Discord Guild
message: <Object> | Discord Message
mentions: Array<String> | ['<@0000>', '<@0000>']
}
Thanks for checking out the documentation. If you require further assistance, please either
- Open a GitHub Issue
- Join our Support Server