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,6 +221,7 @@ class Channel extends SnowFlake {
if (thing.id === "1182819038095799904" || thing.id === "1182820803700625444") { if (thing.id === "1182819038095799904" || thing.id === "1182820803700625444") {
continue; continue;
} }
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)); this.permission_overwrites.set(thing.id, new Permissions(thing.allow, thing.deny));
const permission = this.permission_overwrites.get(thing.id); const permission = this.permission_overwrites.get(thing.id);
if (permission) { if (permission) {
@ -230,6 +231,7 @@ class Channel extends SnowFlake {
} }
} }
} }
}
this.topic = json.topic; this.topic = json.topic;
this.nsfw = json.nsfw; this.nsfw = json.nsfw;
this.position = json.position; this.position = json.position;
@ -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,6 +233,7 @@ class Channel extends SnowFlake{
if(thing.id==="1182819038095799904"||thing.id==="1182820803700625444"){ if(thing.id==="1182819038095799904"||thing.id==="1182820803700625444"){
continue; continue;
} }
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)); this.permission_overwrites.set(thing.id,new Permissions(thing.allow,thing.deny));
const permission=this.permission_overwrites.get(thing.id); const permission=this.permission_overwrites.get(thing.id);
if(permission){ if(permission){
@ -242,6 +243,7 @@ class Channel extends SnowFlake{
} }
} }
} }
}
this.topic=json.topic; this.topic=json.topic;
this.nsfw=json.nsfw; this.nsfw=json.nsfw;
@ -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;