fix perm checking

This commit is contained in:
MathMan05
2026-03-07 10:19:39 -06:00
parent 4e79ccaa91
commit e103b3aa03
2 changed files with 11 additions and 4 deletions

View File

@@ -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);

View File

@@ -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;