discordutility
v0.2.6
Published
A utility module for discord.js!
Downloads
61
Readme
DiscordUtility
DiscordUtility is an utility Package that provides features, such as:
- An AntiSpam System
- An advanced command handler
- A checkCurse Function
- A convertMS Function
- A promptMessage Function
Installation
npm i discordutility
or if you use yarn
yarn add discordutility
Example
Handler:
const { Client } = require("discord.js");
const { Handler } = require("discordutility");
const bot = new Client();
bot.handler = new Handler(bot, { commandFolder: "commands", eventFolder: "events" }, "!").loadCommands().loadEvents();
checkCurse:
//Event Folder, message.js (events/message.js)
const { checkCurse } = require("discordutility");
module.exports = (bot, message) => {
if(checkCurse(message, true)) return message.reply("Do not swear >:(!");
bot.handler.runCommand(message);
};
//Command Folder, help.js (commands/help.js)
module.exports = {
name:"help",
aliases: ["h"],
run: (bot, message, args) => {
message.reply("Hello World!");
}
}
AntiSpam:
const { Client } = require("discord.js");
const { AntiSpam } = require("discordutility");
const bot = new Client();
const antispam = new AntiSpam();
bot.on("message", async(message) => {
if(!message.member) message.member = await message.guild.fetchMember(message.author);
antispam.checkSpam(message);
})