forked from Androz2091/AtlantaBot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCommand.js
More file actions
34 lines (31 loc) · 949 Bytes
/
Command.js
File metadata and controls
34 lines (31 loc) · 949 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
const path = require("path");
const {Permissions} = require("discord.js");
module.exports = class Command {
constructor(client, {
name = null,
description = false,
dirname = false,
enabled = true,
guildOnly = false,
memberPermissions = [],
botPermissions = [],
nsfw = false,
ownerOnly = false,
cooldown = 3000,
options = {}
})
{
memberPermissions.forEach((p, i) => {
memberPermissions[i] = Permissions.FLAGS[p];
});
const bit = memberPermissions.reduce((a, b) => a | b, 0n).toString();
const category = dirname ? dirname.split(path.sep)[dirname.split(path.sep).length - 1] : "Other";
this.client = client;
this.conf = { enabled, guildOnly, botPermissions, nsfw, ownerOnly, cooldown};
this.help = { name, category };
this.applicationCommandBody = {name, description, options, dm_permission: !guildOnly};
if (bit !== "0") {
this.applicationCommandBody["default_member_permissions"] = bit;
}
}
};