discordutil
Powerful set of utilities for Discord.js. New to discordutil? Check out the API Reference.
- An easy-to-use Command & Event Handler.
- Anti-spam module to prevent raids. [Work-in-Progress]
- A Swear Detector to detect swear words in a message.
- Additional Utilities: formatDate(), msToReadable(), parseMs(), randomColor(), and randomNumber().
Installation
npm install discordutil
Usage
Importing the package
const DiscordUtil = ;const Discord = ; // optional
CommandHandler
const bot = ;const handler = client: bot commandDir: __dirname + '/commands' prefix: '!'; // commands/ping.jsmoduleexports = name: 'ping' aliases: 'pong' { return message; }
EventHandler
const bot = ;const handler = client: bot eventDir: __dirname + '/events'; // events/ready.jsmodule { console;}
Swear Detector
// Message eventconst words = 'swear' 'words' 'here';if DiscordUtil return message;
Extra Utilities
DiscordUtil ; // 10/8/2019 ; // 24:00:00 ; // { days: 1, hours: 0, minutes: 0, seconds: 0, ... } ; // #b35c44 ; // 67 ; // { timestamp: 1472750028079, ... }