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") { if (thing.id === "1182819038095799904" || thing.id === "1182820803700625444") {
continue; continue;
} }
this.permission_overwrites.set(thing.id, new Permissions(thing.allow, thing.deny)); if (!this.permission_overwrites.has(thing.id)) { //either a bug in the server requires this, or the API is cursed
const permission = this.permission_overwrites.get(thing.id); this.permission_overwrites.set(thing.id, new Permissions(thing.allow, thing.deny));
if (permission) { const permission = this.permission_overwrites.get(thing.id);
const role = this.guild.roleids.get(thing.id); if (permission) {
if (role) { const role = this.guild.roleids.get(thing.id);
this.permission_overwritesar.push([role, permission]); if (role) {
this.permission_overwritesar.push([role, permission]);
}
} }
} }
} }
@ -281,7 +283,7 @@ class Channel extends SnowFlake {
return true; return true;
} }
for (const thing of member.roles) { for (const thing of member.roles) {
const premission = this.permission_overwrites.get(thing.id); let premission = this.permission_overwrites.get(thing.id);
if (premission) { if (premission) {
const perm = premission.getPermission(name); const perm = premission.getPermission(name);
if (perm) { if (perm) {
@ -654,7 +656,6 @@ class Channel extends SnowFlake {
const id = ++Channel.genid; const id = ++Channel.genid;
if (this.localuser.channelfocus) { if (this.localuser.channelfocus) {
this.localuser.channelfocus.infinite.delete(); this.localuser.channelfocus.infinite.delete();
this.localuser.channelfocus = this;
} }
if (this.guild !== this.localuser.lookingguild) { if (this.guild !== this.localuser.lookingguild) {
this.guild.loadGuild(); this.guild.loadGuild();

View file

@ -152,7 +152,6 @@ class Group extends Channel {
const id = ++Channel.genid; const id = ++Channel.genid;
if (this.localuser.channelfocus) { if (this.localuser.channelfocus) {
this.localuser.channelfocus.infinite.delete(); this.localuser.channelfocus.infinite.delete();
this.localuser.channelfocus = this;
} }
if (this.guild !== this.localuser.lookingguild) { if (this.guild !== this.localuser.lookingguild) {
this.guild.loadGuild(); this.guild.loadGuild();

View file

@ -40,6 +40,7 @@ class Member extends SnowFlake {
if (this.localuser.userMap.has(this?.id)) { if (this.localuser.userMap.has(this?.id)) {
this.user = this.localuser.userMap.get(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() { get guild() {
return this.owner; return this.owner;

View file

@ -233,12 +233,14 @@ class Channel extends SnowFlake{
if(thing.id==="1182819038095799904"||thing.id==="1182820803700625444"){ if(thing.id==="1182819038095799904"||thing.id==="1182820803700625444"){
continue; continue;
} }
this.permission_overwrites.set(thing.id,new Permissions(thing.allow,thing.deny)); if(!this.permission_overwrites.has(thing.id)){//either a bug in the server requires this, or the API is cursed
const permission=this.permission_overwrites.get(thing.id); this.permission_overwrites.set(thing.id,new Permissions(thing.allow,thing.deny));
if(permission){ const permission=this.permission_overwrites.get(thing.id);
const role=this.guild.roleids.get(thing.id); if(permission){
if(role){ const role=this.guild.roleids.get(thing.id);
this.permission_overwritesar.push([role,permission]); if(role){
this.permission_overwritesar.push([role,permission]);
}
} }
} }
} }
@ -295,7 +297,7 @@ class Channel extends SnowFlake{
return true; return true;
} }
for(const thing of member.roles){ for(const thing of member.roles){
const premission=this.permission_overwrites.get(thing.id); let premission=this.permission_overwrites.get(thing.id);
if(premission){ if(premission){
const perm=premission.getPermission(name); const perm=premission.getPermission(name);
if(perm){ if(perm){
@ -665,7 +667,6 @@ class Channel extends SnowFlake{
const id=++Channel.genid; const id=++Channel.genid;
if(this.localuser.channelfocus){ if(this.localuser.channelfocus){
this.localuser.channelfocus.infinite.delete(); this.localuser.channelfocus.infinite.delete();
this.localuser.channelfocus=this;
} }
if(this.guild!==this.localuser.lookingguild){ if(this.guild!==this.localuser.lookingguild){
this.guild.loadGuild(); this.guild.loadGuild();

View file

@ -161,7 +161,6 @@ class Group extends Channel{
const id=++Channel.genid; const id=++Channel.genid;
if(this.localuser.channelfocus){ if(this.localuser.channelfocus){
this.localuser.channelfocus.infinite.delete(); this.localuser.channelfocus.infinite.delete();
this.localuser.channelfocus=this;
} }
if(this.guild!==this.localuser.lookingguild){ if(this.guild!==this.localuser.lookingguild){
this.guild.loadGuild(); this.guild.loadGuild();

View file

@ -42,6 +42,7 @@ class Member extends SnowFlake{
if(this.localuser.userMap.has(this?.id)){ if(this.localuser.userMap.has(this?.id)){
this.user=this.localuser.userMap.get(this?.id) as User; 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(){ get guild(){
return this.owner; return this.owner;