Various changes cleaning up how user data is stored

This commit is contained in:
MathMan05
2024-06-15 00:22:50 -05:00
parent 618cbf6167
commit 3ed09d615d
7 changed files with 163 additions and 50 deletions

View File

@@ -26,11 +26,13 @@ class guild{
*/
}
constructor(JSON,owner){
if(JSON===-1){
return;
}
console.log(JSON);
this.owner=owner;
this.headers={"Content-type": "application/json; charset=UTF-8",Authorization:this.owner.userinfo.token};
if(!this.owner){
console.error("Owner was not included, please fix")
}
@@ -103,14 +105,14 @@ class guild{
console.log(build,thing)
fetch(info.api.toString()+"/v9/guilds/"+this.id+"/channels",{
method:"PATCH",
headers:{"Content-type": "application/json; charset=UTF-8",Authorization:token},
headers:this.headers,
body:JSON.stringify([thing])
});
}
}else{
fetch(info.api.toString()+"/v9/guilds/"+this.id+"/channels",{
method:"PATCH",
headers:{"Content-type": "application/json; charset=UTF-8",Authorization:token},
headers:this.headers,
body:JSON.stringify(build)
});
}
@@ -171,7 +173,7 @@ class guild{
this.unreads();
fetch(info.api.toString()+"/v9/read-states/ack-bulk",{
method:"POST",
headers:{"Content-type": "application/json; charset=UTF-8",Authorization:token},
headers:this.headers,
body:JSON.stringify(build)
})
}
@@ -260,7 +262,7 @@ class guild{
createChannel(name,type){
fetch(info.api.toString()+"/guilds/"+this.id+"/channels",{
method:"Post",
headers:{"Content-type": "application/json; charset=UTF-8",Authorization:token},
headers:this.headers,
body:JSON.stringify({name: name, type: type})
})
}