Home - ThatsLiamS/discord.js-ghost-ping GitHub Wiki

Verison Downloads npm bundle size

GhostPing Wiki

Installation

  1. Open the CMD / Shell / Terminal
  2. Naviagate to the project's Root Directory
  3. Run either command:
$ npm install discord.js-ghost-ping
$ yarn add discord.js-ghost-ping

Usage

  1. Import the package
const GhostPing = require('discord.js-ghost-ping');
import GhostPing from 'discord.js-ghost-ping';
  1. 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 and messageUpdate.
client.on('messageDelete', message => { 
    ...
})
client.on('messageUpdate', (oldMessage, newMessage) => {
    ...
})
  1. 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}` });
})

Return Object

{
	author:      <Object>     |  Discord User
	channel:     <Object>     |  Discord TextChannel
	guild:       <Object>     |  Discord Guild

	message:     <Object>     |  Discord Message
	mentions:  Array<String>  |  ['<@0000>', '<@0000>']
}

Support

Thanks for checking out the documentation. If you require further assistance, please either

⚠️ **GitHub.com Fallback** ⚠️