Finish preliminary rework, ready to test
This commit is contained in:
parent
57893e7f76
commit
d0a1beb809
177 changed files with 854 additions and 707 deletions
|
@ -4,6 +4,7 @@ import { trimLines, preEmbedPadding, EmbedWith } from "../../../utils";
|
|||
import moment from "moment-timezone";
|
||||
import humanizeDuration from "humanize-duration";
|
||||
import { TimeAndDatePlugin } from "../../TimeAndDate/TimeAndDatePlugin";
|
||||
import { Role, MessageEmbedOptions } from "discord.js";
|
||||
|
||||
const MENTION_ICON = "https://cdn.discordapp.com/attachments/705009450855039042/839284872152481792/mention.png";
|
||||
|
||||
|
@ -11,7 +12,7 @@ export async function getRoleInfoEmbed(
|
|||
pluginData: GuildPluginData<UtilityPluginType>,
|
||||
role: Role,
|
||||
requestMemberId?: string,
|
||||
): Promise<EmbedOptions> {
|
||||
): Promise<MessageEmbedOptions> {
|
||||
const embed: EmbedWith<"fields"> = {
|
||||
fields: [],
|
||||
};
|
||||
|
@ -29,12 +30,12 @@ export async function getRoleInfoEmbed(
|
|||
? await timeAndDate.inMemberTz(requestMemberId, createdAt)
|
||||
: timeAndDate.inGuildTz(createdAt);
|
||||
const prettyCreatedAt = tzCreatedAt.format(timeAndDate.getDateFormat("pretty_datetime"));
|
||||
const roleAge = humanizeDuration(Date.now() - role.createdAt, {
|
||||
const roleAge = humanizeDuration(Date.now() - role.createdTimestamp, {
|
||||
largest: 2,
|
||||
round: true,
|
||||
});
|
||||
|
||||
const rolePerms = Object.keys(role.permissions.json).map(p =>
|
||||
const rolePerms = Object.keys(role.permissions.toJSON()).map(p =>
|
||||
p
|
||||
// Voice channel related permission names start with 'voice'
|
||||
.replace(/^voice/i, "")
|
||||
|
@ -44,7 +45,7 @@ export async function getRoleInfoEmbed(
|
|||
);
|
||||
|
||||
// -1 because of the @everyone role
|
||||
const totalGuildRoles = pluginData.guild.roles.size - 1;
|
||||
const totalGuildRoles = pluginData.guild.roles.cache.size - 1;
|
||||
|
||||
embed.fields.push({
|
||||
name: preEmbedPadding + "Role information",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue