2.4.31 • Published 11 months ago
revolthandler.js v2.4.31
revolthandler.js
Description
Easy command handling for revolt.js
Table of contents
About
command handler for revolt.js bot project
Badges
Install
npm i revolthandler.js
Example
Handler
Setup
CommonJS
const revolt = require("revolt.js");
const client = new revolt.Client();
const revoltHandler = require("revolthandler.js");
const handler = new revoltHandler.Handler({
client: client, //required
prefix: "!", //required
owners: ["Your Revolt ID"], //optional , optional add more owner Id
path: "./commands", //optional, (default : "./commands")
});
client.once("ready", () => {
handler.start();
});
client.loginBot("YOUR_BOT_TOKEN_HERE");
EsModule
//...
import { Handler } from "revolthandler.js";
const handler = new Handler({
client: client, //required
prefix: "!", //required
owners: ["Your Revolt ID"], //optional , optional add more owner Id
path: "./commands", //optinal, (default : "./commands")
});
//...
Standart using example
CommonJS
//"./commands/general/ping.js"
exports.default = {
name: "ping",
description: "Ping!", //description :P
//Be careful
code(message, args, client) {
//Your code here
message.channel.sendMessage("Pong");
},
};
EsModule
export default {
name:"ping",
description:"Ping!"
code(message:any,args:string[],client:any){
//Your code here
}
}
Aliases example
//"./commands/general/ping.js"
exports.default = {
name: ["ping", "delay"],
description: "Ping!", //description :P
//Be careful
code(message, args, client /*,command*/) {
//Your code here
},
};
Only owner command example
//"./commands/owner/test.js"
exports.default = {
name: ["eval", "deneme"],
ownerOnly: {
errorMsg(message, args, client, command) {
//optional
message.reply("You can't use this command");
},
},
code(message, args, client) {
//your code here
},
};
Only perms command example
//"./commands/moderate/perm.js"
exports.default = {
name: "perm",
permissions: {
perms: {
user: ["KickMembers"],
bot: ["KickMembers"],
}, //You can see the perm names in : https://revolt.js.org/classes/ServerMember.html#hasPermission
errorMsg(message, args, client, command) {
//optional
message.reply(
`You must have ${command.permission.perms.user.join(
","
)} permission(s) to use this command`
);
},
botErrorMsg(message, args, client, command) {
//optional
message.reply(
`I need the ${command.permission.perms.bot.join(
","
)} permission(s) to execute this command`
);
},
},
code(msg, args, client) {
//Your code here
},
};
Guild Only
//"./commands/general/indm.js"
exports.default = {
name: "in-server",
guildOnly: {
errorMsg(message, author, client) {
//optional
message.reply("You can't use this commmand in dm or group");
},
},
code(message, args, client) {
//Your code here
},
};
Non Prefixed
//"./commands/general/nonprefixed.js"
exports.default = {
name: "withoutprefix", //WARN : The command name is case sensitive here!
nonPrefixed: true,
code(message, args, client) {
//Your code here
},
};
Embed Builder & Uploader
All in one
const { EmbedBuilder, Uploader } = require("revolthandler.js");
exports.default = {
name: "coolembed",
async code(message, args, client) {
const myuploader = new Uploader(client);
const myemb = new EmbedBuilder();
myemb
.setDescription("Cool describe")
.setColour("red") //hex code or name is acceptable
.setTitle("Cool title")
.setMedia(
await myuploader.upload("imagelink/imagebuffer", "filename.png")
) ////You can add an big picture or file
.setUrl("https://www.npmjs.com/package/revolthandler.js")
.setIconUrl("imagelink"); //You can add an picture in front of the title
message.channel.sendMessage({ embeds: [myemb] });
},
};
Will add new features in the future
2.4.1
11 months ago
2.4.0
11 months ago
2.4.3
11 months ago
2.4.2
11 months ago
2.4.31
11 months ago
2.4.21
11 months ago
2.3.0
1 year ago
2.3.1
1 year ago
2.3.0-beta.1
2 years ago
2.2.0
2 years ago
1.2.0
2 years ago
1.1.1
3 years ago
1.0.2
3 years ago
1.1.0
3 years ago
1.0.1
3 years ago
1.0.0
3 years ago
1.0.4
3 years ago
1.1.2
3 years ago
1.0.3
3 years ago
2.1.2
2 years ago
2.1.1
2 years ago
2.0.11
2 years ago
1.2.0-beta.1
2 years ago
1.2.0-beta.3
2 years ago
1.2.0-beta.2
2 years ago
1.2.0-beta.5
2 years ago
1.2.0-beta.4
2 years ago
2.1.0
2 years ago
2.0.1
2 years ago
1.2.0-beta.7
2 years ago
2.0.0
2 years ago
1.2.0-beta.6
2 years ago
1.2.0-beta.10
2 years ago
2.1.11
2 years ago
1.0.11
3 years ago
1.0.12
3 years ago
0.0.6
4 years ago
0.0.5
4 years ago
0.0.4
4 years ago
0.0.3
4 years ago
0.0.2
4 years ago
0.0.1
4 years ago