This package creates easy to use & configurable functions to be used with discord.js

Usage no npm install needed!

<script type="module">
  import discordJsTools from 'https://cdn.skypack.dev/discord.js-tools';


Discord server NPM version NPM downloads License

NPM info


Node.js 6.0.0 or newer is required.
Ignore any warnings about unmet peer dependencies, as they're all optional.

var tools = require('discord.js-tools');

Required packages

  • discord.js the core of this project (npm install discord.js --save)


Message Collector

tools.messageCollector(message, 'question', 'answer')

//You need to put the question someone has to answer Yes or No on in 'question'.
//And answer will be the output if someone says Yes.
//Message is the variable you use for the message event!

Random Number/Word

console.log(tools.arrayRandom(['1', '2']))

//You can replace 1 or 2 by anthing you want and extend it so far as you want!


tools.purge(message, client, amount)

//You can choose an amount between 1 and 50.
//Client is the variable you have for new Discord.Client();
//Message is the variable you use for the message event!

Get a member with id/mention/username search

msg - The msg object
args - (id / mention/ username search)
embedColor - The color for the embed
embedTime - Time to stop listening for a msg (miliseconds)
return a promise
tools.fetchMember(message, args, embedColor, embedTime).then(member => {
   //a member as been found, you can now use member
}).catch(err => {
   //an error happen you should log it!

Example usage

var tools = require('discord-js-tools')

var prefix = {};

client.on('message', message => {
tools.messageCollector(message, 'do you like spikey yes or no?', 'i like him too!')

tools.arrayRandom(['1', '2', '3']).then({i =>

if (message.content.startsWith(prefix + 'purge')) {
var amount = message.content.split(' ').slice(1);
      tools.purge(message, client, amount)


client.on('ready', () => {
  console.log('Logged in!');

client.login('your token');