1.0.1 • Published 5 years ago
discord.js-plugins v1.0.1
discord.js-plugins
discord.js-plugins is a 3rd party module for discord.js
Subject | Description |
---|---|
Trial | Information about free trial |
Purchasing | How to purchase a product key |
Installation | How to install the module |
Usage | How to do a import the module |
Plugins | Learn how to use a specific plugin |
Examples | Examples of what you can make |
Trial
If you want to try out discord.js-plugins you can use the product key called trial you only get the following plugins tho.. Prompt, Request, Database
Purchasing
To purchase a product key go to shoppy.gg. If there is any problems contact Niiko#0713 on Discord.
Installation
Use the package manager npm to install the module.
npm install discord.js --save
npm install discord.js-plugins --save
Usage
const Discord = require("discord.js");
const client = new Discord.Client();
require("discord.js-plugins")(Discord, client, "PRODUCT_KEY").then(() => {
// Initialize discord.js bot code..
})
Plugins
Subject | Description |
---|---|
Captcha | Make captcha verification |
Database | Easily manage a database |
Request | Make HTTP Web Requests |
ReactMessage | Actions when reacted to message |
Prompt | Question the target and get answer |
Captcha
let captcha = new Discord.Captcha(
message.author.id, // target id
(msg) => { msg.channel.send("valid") }, // valid callback
(msg) => { msg.channel.send("invalid") }, // invalid callback
);
captcha.send(message.channel); // channel where to send message
Database
let database = new Discord.Database("GLOBAL"); // GLOBAL = Synced with all server, guild id = guild
database.get("GROUP"); // gets group value
database.set("GROUP", "VALUE"); // sets group value
database.push("GROUP", "VALUE"); // pushes value (only works if value is an array)
database.remove("GROUP"); // removes a group
database.exist("GROUP"); // checks if a group exists
Request
new Discord.Request("URL", {
method: "GET"
}).then(response => {
console.log(response); // response = raw text
});
ReactMessage
let react = new Discord.ReactMessage(
"Hello there react to this message", // message content, could be an embed
["👋", "👊"], // only sends callback if these emojis, null = all emojis
(msg, reaction, user) => { msg.channel.send("caught you reacting.") } // react callback
);
react.send(message.channel); // channel where to send message
Prompt
let prompt = new Discord.Prompt(
message.author.id, // target id
"Is discord.js-plugins cool?" // message content, could be embed
);
prompt.send(message.channel); // channel where to send message
Examples
React to message for role
const Discord = require("discord.js");
const client = new Discord.Client();
require("discord.js-plugins")(Discord, client, "PRODUCT_KEY").then(() => {
client.on("message", (message) => {
if (message.content === "role") {
var react = new Discord.ReactMessage("React to this for verified role", null, (msg, reaction, user) => {
var role = null;
var target = null;
/* Find Role */ msg.guild.roles.cache.filter(r => { if (r.name === 'verified') role = r; });
/* Find Member */ msg.guild.members.cache.filter(r => { if (r.id === user.id) target = r; });
/* Add role to member */ target.roles.add(role);
});
react.send(message.channel); /* Send React message */
}
})
})