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

@ -5,7 +5,7 @@
*/
import { Devs } from "@utils/constants";
import { getCurrentGuild } from "@utils/discord";
import { getCurrentGuild, getGuildRoles } from "@utils/discord";
import definePlugin from "@utils/types";
import { findByPropsLazy } from "@webpack";
import { Clipboard, Menu, PermissionStore, TextAndImagesSettingsStores } from "@webpack/common";
@ -47,7 +47,9 @@ export default definePlugin({
contextMenus: {
"dev-context"(children, { id }: { id: string; }) {
const guild = getCurrentGuild();
const role = guild?.roles[id];
if (!guild) return;
const role = getGuildRoles(guild.id)[id];
if (!role) return;
if (role.colorString) {