From ee9483f3506a2251812de30ac5bad13ecadbe06d Mon Sep 17 00:00:00 2001 From: MathMan05 Date: Mon, 9 Sep 2024 22:15:06 -0500 Subject: [PATCH] various fixes --- .dist/channel.js | 17 +++++++++-------- .dist/direct.js | 1 - .dist/member.js | 1 + webpage/channel.ts | 17 +++++++++-------- webpage/direct.ts | 1 - webpage/member.ts | 1 + 6 files changed, 20 insertions(+), 18 deletions(-) diff --git a/.dist/channel.js b/.dist/channel.js index cf1aa1c..c125a48 100644 --- a/.dist/channel.js +++ b/.dist/channel.js @@ -221,12 +221,14 @@ class Channel extends SnowFlake { if (thing.id === "1182819038095799904" || thing.id === "1182820803700625444") { continue; } - this.permission_overwrites.set(thing.id, new Permissions(thing.allow, thing.deny)); - const permission = this.permission_overwrites.get(thing.id); - if (permission) { - const role = this.guild.roleids.get(thing.id); - if (role) { - this.permission_overwritesar.push([role, permission]); + if (!this.permission_overwrites.has(thing.id)) { //either a bug in the server requires this, or the API is cursed + this.permission_overwrites.set(thing.id, new Permissions(thing.allow, thing.deny)); + const permission = this.permission_overwrites.get(thing.id); + if (permission) { + const role = this.guild.roleids.get(thing.id); + if (role) { + this.permission_overwritesar.push([role, permission]); + } } } } @@ -281,7 +283,7 @@ class Channel extends SnowFlake { return true; } for (const thing of member.roles) { - const premission = this.permission_overwrites.get(thing.id); + let premission = this.permission_overwrites.get(thing.id); if (premission) { const perm = premission.getPermission(name); if (perm) { @@ -654,7 +656,6 @@ class Channel extends SnowFlake { const id = ++Channel.genid; if (this.localuser.channelfocus) { this.localuser.channelfocus.infinite.delete(); - this.localuser.channelfocus = this; } if (this.guild !== this.localuser.lookingguild) { this.guild.loadGuild(); diff --git a/.dist/direct.js b/.dist/direct.js index 3a7abbd..cdcad07 100644 --- a/.dist/direct.js +++ b/.dist/direct.js @@ -152,7 +152,6 @@ class Group extends Channel { const id = ++Channel.genid; if (this.localuser.channelfocus) { this.localuser.channelfocus.infinite.delete(); - this.localuser.channelfocus = this; } if (this.guild !== this.localuser.lookingguild) { this.guild.loadGuild(); diff --git a/.dist/member.js b/.dist/member.js index c9dcd34..9bc8d13 100644 --- a/.dist/member.js +++ b/.dist/member.js @@ -40,6 +40,7 @@ class Member extends SnowFlake { if (this.localuser.userMap.has(this?.id)) { this.user = this.localuser.userMap.get(this?.id); } + this.roles.sort((a, b) => { return (this.guild.roles.indexOf(a) - this.guild.roles.indexOf(b)); }); } get guild() { return this.owner; diff --git a/webpage/channel.ts b/webpage/channel.ts index f63ecc7..5ab1884 100644 --- a/webpage/channel.ts +++ b/webpage/channel.ts @@ -233,12 +233,14 @@ class Channel extends SnowFlake{ if(thing.id==="1182819038095799904"||thing.id==="1182820803700625444"){ continue; } - this.permission_overwrites.set(thing.id,new Permissions(thing.allow,thing.deny)); - const permission=this.permission_overwrites.get(thing.id); - if(permission){ - const role=this.guild.roleids.get(thing.id); - if(role){ - this.permission_overwritesar.push([role,permission]); + if(!this.permission_overwrites.has(thing.id)){//either a bug in the server requires this, or the API is cursed + this.permission_overwrites.set(thing.id,new Permissions(thing.allow,thing.deny)); + const permission=this.permission_overwrites.get(thing.id); + if(permission){ + const role=this.guild.roleids.get(thing.id); + if(role){ + this.permission_overwritesar.push([role,permission]); + } } } } @@ -295,7 +297,7 @@ class Channel extends SnowFlake{ return true; } for(const thing of member.roles){ - const premission=this.permission_overwrites.get(thing.id); + let premission=this.permission_overwrites.get(thing.id); if(premission){ const perm=premission.getPermission(name); if(perm){ @@ -665,7 +667,6 @@ class Channel extends SnowFlake{ const id=++Channel.genid; if(this.localuser.channelfocus){ this.localuser.channelfocus.infinite.delete(); - this.localuser.channelfocus=this; } if(this.guild!==this.localuser.lookingguild){ this.guild.loadGuild(); diff --git a/webpage/direct.ts b/webpage/direct.ts index 0f4e93c..caf13a2 100644 --- a/webpage/direct.ts +++ b/webpage/direct.ts @@ -161,7 +161,6 @@ class Group extends Channel{ const id=++Channel.genid; if(this.localuser.channelfocus){ this.localuser.channelfocus.infinite.delete(); - this.localuser.channelfocus=this; } if(this.guild!==this.localuser.lookingguild){ this.guild.loadGuild(); diff --git a/webpage/member.ts b/webpage/member.ts index dd0581a..f92eaac 100644 --- a/webpage/member.ts +++ b/webpage/member.ts @@ -42,6 +42,7 @@ class Member extends SnowFlake{ if(this.localuser.userMap.has(this?.id)){ this.user=this.localuser.userMap.get(this?.id) as User; } + this.roles.sort((a,b)=>{return (this.guild.roles.indexOf(a)-this.guild.roles.indexOf(b))}); } get guild(){ return this.owner;