2023-06-06 23:22:27 +00:00
|
|
|
const fn = require('../modules/functions.js');
|
2023-06-06 23:29:48 +00:00
|
|
|
const { PermissionsBitField } = require('discord.js');
|
2023-06-06 23:22:27 +00:00
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
name: "permissions",
|
|
|
|
description: "",
|
|
|
|
usage: ".permissions",
|
|
|
|
permission: "devTeam", // "devTeam" or "owner"
|
|
|
|
async execute(message, commandData) {
|
|
|
|
if (fn.dotCommands.checkPermissions(this.permission, message.author.id)) {
|
|
|
|
try {
|
|
|
|
const me = message.guild.members.me;
|
|
|
|
const guildPerms = me.permissions;
|
|
|
|
const manageRoles = guildPerms.has(PermissionsBitField.Flags.ManageRoles);
|
|
|
|
const mentionEveryone = guildPerms.has(PermissionsBitField.Flags.MentionEveryone);
|
2023-06-06 23:29:48 +00:00
|
|
|
const channelPerms = me.permissionsIn(message.channel);
|
2023-06-06 23:22:27 +00:00
|
|
|
const viewChannel = channelPerms.has(PermissionsBitField.Flags.ViewChannel);
|
|
|
|
const sendMessages = channelPerms.has(PermissionsBitField.Flags.SendMessages);
|
|
|
|
const responseParts = [
|
2023-06-06 23:29:48 +00:00
|
|
|
`This is the status of my permissions in this server and this channel (<#${message.channel.id}>)`,
|
2023-06-06 23:22:27 +00:00
|
|
|
`**Guild Permissions**`,
|
|
|
|
`Manage Roles: ${manageRoles}`,
|
|
|
|
`Mention All Roles: ${mentionEveryone}`,
|
|
|
|
`**Channel Permissions**`,
|
|
|
|
`View Channel: ${viewChannel}`,
|
|
|
|
`Send Messages: ${sendMessages}`
|
|
|
|
];
|
|
|
|
const replyEmbed = fn.builders.embed(responseParts.join("\n"));
|
|
|
|
await message.reply(replyEmbed);
|
|
|
|
} catch (err) {
|
|
|
|
console.error(err);
|
|
|
|
await message.reply(fn.builders.errorEmbed("There was an error running the command."));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|