2022-01-13 00:56:24 +05:00
|
|
|
const Command = require("../../base/Command"),
|
2022-01-04 02:18:28 +05:00
|
|
|
Discord = require("discord.js");
|
|
|
|
|
|
|
|
const permissions = Object.keys(Discord.Permissions.FLAGS);
|
|
|
|
|
|
|
|
class Permissions extends Command {
|
|
|
|
constructor(client) {
|
|
|
|
super(client, {
|
|
|
|
name: "permissions",
|
|
|
|
dirname: __dirname,
|
|
|
|
enabled: true,
|
|
|
|
guildOnly: true,
|
|
|
|
aliases: ["perms"],
|
|
|
|
memberPermissions: [],
|
|
|
|
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
|
|
|
nsfw: false,
|
|
|
|
ownerOnly: false,
|
|
|
|
cooldown: 1000
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
async run(message) {
|
|
|
|
const member = message.mentions.members.first() || message.member;
|
|
|
|
let text = "```\n" + `${message.translate("general/permissions:TITLE", { user: member.user.username, channel: message.channel.name })}\n\n`;
|
|
|
|
const mPermissions = message.channel.permissionsFor(member);
|
|
|
|
const total = {
|
|
|
|
denied: 0,
|
|
|
|
allowed: 0
|
|
|
|
};
|
|
|
|
permissions.forEach((perm) => {
|
|
|
|
if (!mPermissions.has(perm)) {
|
|
|
|
text += `${perm} ❌\n`;
|
|
|
|
total.denied++;
|
|
|
|
} else {
|
|
|
|
text += `${perm} ✅\n`;
|
|
|
|
total.allowed++;
|
2022-01-13 00:26:23 +05:00
|
|
|
}
|
2022-01-04 02:18:28 +05:00
|
|
|
});
|
|
|
|
text += `\n${total.allowed} ✅ | ${total.denied} ❌` + "\n```";
|
2022-01-05 00:24:57 +05:00
|
|
|
message.channel.send({
|
|
|
|
content: text
|
|
|
|
});
|
2022-01-04 02:18:28 +05:00
|
|
|
}
|
2022-01-13 00:26:23 +05:00
|
|
|
}
|
2022-01-04 02:18:28 +05:00
|
|
|
|
|
|
|
module.exports = Permissions;
|