From e103b3aa036fca554ff4f0dc2eacd77b131259ea Mon Sep 17 00:00:00 2001 From: MathMan05 Date: Sat, 7 Mar 2026 10:19:39 -0600 Subject: [PATCH] fix perm checking --- src/webpage/channel.ts | 2 +- src/webpage/index.ts | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/webpage/channel.ts b/src/webpage/channel.ts index 9ba724a..6a1e25b 100644 --- a/src/webpage/channel.ts +++ b/src/webpage/channel.ts @@ -1055,7 +1055,7 @@ class Channel extends SnowFlake { decdiv.appendChild(myhtml); caps.appendChild(decdiv); - if (admin) { + if (this.guild.member.hasPermission("MANAGE_CHANNELS")) { const addchannel = document.createElement("span"); addchannel.classList.add("addchannel", "svgicon", "svg-plus"); caps.appendChild(addchannel); diff --git a/src/webpage/index.ts b/src/webpage/index.ts index d5f8498..66fbfec 100644 --- a/src/webpage/index.ts +++ b/src/webpage/index.ts @@ -114,7 +114,11 @@ if (window.location.pathname.startsWith("/channels")) { thisUser.lookingguild.createchannels(); } }, - {visible: () => thisUser.isAdmin()}, + { + visible: function () { + return thisUser.channelfocus?.guild.member.hasPermission("MANAGE_CHANNELS") || false; + }, + }, ); menu.addButton( @@ -124,10 +128,13 @@ if (window.location.pathname.startsWith("/channels")) { thisUser.lookingguild.createcategory(); } }, - {visible: () => thisUser.isAdmin()}, + { + visible: function () { + return thisUser.channelfocus?.guild.member.hasPermission("MANAGE_CHANNELS") || false; + }, + }, ); const channelw = document.getElementById("channelw"); - console.log(channelw); if (channelw) channelw.addEventListener("keypress", (e) => { if (e.ctrlKey || e.altKey || e.metaKey || e.metaKey) return;