Add workaround for guild role api changes on canary/ptb

fixes RoleColorEverywhere, ServerInfo, PermissionViewer, BetterRoleContext
This commit is contained in:
Vendicated 2024-03-11 16:13:07 +01:00
parent 497f0de9a1
commit 34390e0365
No known key found for this signature in database
GPG key ID: D66986BAF75ECF18
8 changed files with 35 additions and 18 deletions

View file

@ -21,6 +21,7 @@ import "./styles.css";
import { findGroupChildrenByChildId, NavContextMenuPatchCallback } from "@api/ContextMenu";
import { definePluginSettings } from "@api/Settings";
import { Devs } from "@utils/constants";
import { getGuildRoles } from "@utils/discord";
import definePlugin, { OptionType } from "@utils/types";
import { ChannelStore, GuildMemberStore, GuildStore, Menu, PermissionsBits, UserStore } from "@webpack/common";
import type { Guild, GuildMember } from "discord-types/general";
@ -107,7 +108,7 @@ function MenuItem(guildId: string, id?: string, type?: MenuItemParentType) {
}
default: {
permissions = Object.values(guild.roles).map(role => ({
permissions = Object.values(getGuildRoles(guild.id)).map(role => ({
type: PermissionType.Role,
...role
}));