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');
- 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 with anything you want and extend it as far as you want!
Purge
tools.purge(message, client, amount)
//You can choose an amount between 1 and 99.
//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 (milliseconds)
return a promise
**/
tools.fetchMember(message, args, embedColor, embedTime).then(member => {
//a member as been found, you can now use member
console.log(member);
}).catch(err => {
//an error happened, you should log it!
console.log(err);
});
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 =>
console.log(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');