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;