mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-10 12:25:02 +00:00
Merge pull request #307 from almeidx/role-info-perms
fix permissions not showing properly in roleinfo
This commit is contained in:
commit
63fa5bc533
2 changed files with 51 additions and 9 deletions
|
@ -1,8 +1,9 @@
|
|||
import { MessageEmbedOptions, Role } from "discord.js";
|
||||
import { MessageEmbedOptions, Permissions, Role } from "discord.js";
|
||||
import humanizeDuration from "humanize-duration";
|
||||
import { GuildPluginData } from "knub";
|
||||
import moment from "moment-timezone";
|
||||
import { EmbedWith, preEmbedPadding, trimLines } from "../../../utils";
|
||||
import { PERMISSION_NAMES } from "../../../utils/permissionNames.js";
|
||||
import { TimeAndDatePlugin } from "../../TimeAndDate/TimeAndDatePlugin";
|
||||
import { UtilityPluginType } from "../types";
|
||||
|
||||
|
@ -35,14 +36,9 @@ export async function getRoleInfoEmbed(
|
|||
round: true,
|
||||
});
|
||||
|
||||
const rolePerms = Object.keys(role.permissions.toJSON()).map((p) =>
|
||||
p
|
||||
// Voice channel related permission names start with 'voice'
|
||||
.replace(/^voice/i, "")
|
||||
.replace(/([a-z])([A-Z])/g, "$1 $2")
|
||||
.toLowerCase()
|
||||
.replace(/(^\w{1})|(\s{1}\w{1})/g, (l) => l.toUpperCase()),
|
||||
);
|
||||
const rolePerms = role.permissions.has(Permissions.FLAGS.ADMINISTRATOR)
|
||||
? [PERMISSION_NAMES.ADMINISTRATOR]
|
||||
: role.permissions.toArray().map((p) => PERMISSION_NAMES[p]);
|
||||
|
||||
// -1 because of the @everyone role
|
||||
const totalGuildRoles = pluginData.guild.roles.cache.size - 1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue