fix url bugs and improve account switcher

This commit is contained in:
MathMan05
2024-08-11 15:16:49 -05:00
parent 0fe2966ad1
commit 5148e1b77b
19 changed files with 186 additions and 175 deletions

View File

@@ -128,7 +128,7 @@ class Guild{
noti
],
["button","","submit",_=>{
fetch(this.info.api.toString()+"/v9/users/@me/guilds/settings",{
fetch(this.info.api+"/v9/users/@me/guilds/settings",{
method:"PATCH",
headers:this.headers,
body:JSON.stringify({
@@ -173,7 +173,7 @@ class Guild{
full.show();
}
async leave(){
return fetch(this.info.api.toString()+"/users/@me/guilds/"+this.snowflake,{
return fetch(this.info.api+"/users/@me/guilds/"+this.snowflake,{
method:"DELETE",
headers:this.headers
})
@@ -221,14 +221,14 @@ class Guild{
if(serverbug){
for(const thing of build){
console.log(build,thing)
fetch(this.info.api.toString()+"/v9/guilds/"+this.snowflake+"/channels",{
fetch(this.info.api+"/v9/guilds/"+this.snowflake+"/channels",{
method:"PATCH",
headers:this.headers,
body:JSON.stringify([thing])
});
}
}else{
fetch(this.info.api.toString()+"/v9/guilds/"+this.snowflake+"/channels",{
fetch(this.info.api+"/v9/guilds/"+this.snowflake+"/channels",{
method:"PATCH",
headers:this.headers,
body:JSON.stringify(build)
@@ -256,7 +256,7 @@ class Guild{
if(this.properties.icon!=null){
const img=document.createElement("img");
img.classList.add("pfp","servericon");
img.src=this.info.cdn.toString()+"/icons/"+this.properties.id+"/"+this.properties.icon+".png";
img.src=this.info.cdn+"/icons/"+this.properties.id+"/"+this.properties.icon+".png";
divy.appendChild(img)
img.onclick=()=>{
console.log(this.loadGuild)
@@ -323,7 +323,7 @@ class Guild{
full.show();
}
async delete(){
return fetch(this.info.api.toString()+"/guilds/"+this.snowflake+"/delete",{
return fetch(this.info.api+"/guilds/"+this.snowflake+"/delete",{
method:"POST",
headers:this.headers,
})
@@ -372,7 +372,7 @@ class Guild{
}
}
this.unreads();
fetch(this.info.api.toString()+"/v9/read-states/ack-bulk",{
fetch(this.info.api+"/v9/read-states/ack-bulk",{
method:"POST",
headers:this.headers,
body:JSON.stringify(build)
@@ -499,14 +499,14 @@ class Guild{
this.printServers();
}
createChannel(name:string,type:number){
fetch(this.info.api.toString()+"/guilds/"+this.snowflake+"/channels",{
fetch(this.info.api+"/guilds/"+this.snowflake+"/channels",{
method:"POST",
headers:this.headers,
body:JSON.stringify({name: name, type: type})
})
}
async createRole(name:string){
const fetched=await fetch(this.info.api.toString()+"/guilds/"+this.snowflake+"roles",{
const fetched=await fetch(this.info.api+"/guilds/"+this.snowflake+"roles",{
method:"POST",
headers:this.headers,
body:JSON.stringify({
@@ -526,7 +526,7 @@ class Guild{
role.permissions.allow=perms.allow;
role.permissions.deny=perms.deny;
await fetch(this.info.api.toString()+"/guilds/"+this.snowflake+"/roles/"+this.snowflake,{
await fetch(this.info.api+"/guilds/"+this.snowflake+"/roles/"+this.snowflake,{
method:"PATCH",
headers:this.headers,
body:JSON.stringify({