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

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

View File

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

View File

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