various fixes

This commit is contained in:
MathMan05 2024-09-09 22:15:06 -05:00
parent ab842f8f9b
commit ee9483f350
6 changed files with 20 additions and 18 deletions

View file

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

View file

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

View file

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