1.0.0 • Published 6 years ago
dismodular v1.0.0
Dismodular
A wrapper over discord.js for modular discord bots.
Usage:
Install the module
yarn add dismodularor
npm install dismodularRequire the module in your code
const { Bot } = require("dismodular");Create a new client
const client = new Bot("token", {
prefix: "!",
databasePath: "./database.db"
});Tip: The client extends the client of Discord.js, so you can write normal discord.js code over it.
Using modules
Install a module to add a feature
yarn add dismodular-join-messageRequire the module in your code
const JoinMessage = require("dismodular-join-message");Start the module
JoinMessage(client, {
message: "Welcome <@{member_id}> to ***{guild_name}***! Make sure to read the <#649726131922272332>!",
channelID: "channel_id"
})That's all! Start the bot in node and you should get notifications when new members join.
Creating modules
Tip: Every module should have the same or a similar structure.
Make a new file.
touch warn.jsAdd a exported function to the file
module.exports = async function(bot, options) {
// code
}Add your listeners or other features in the file
bot.addCommandListener((message, args, command) => {
// message is a Discord.js message, args is an array of strings and command is a string.
// code
})Done! Now you can publish your file to NPM.