diff --git a/.dist/guild.js b/.dist/guild.js index 73733cb..6a921a9 100644 --- a/.dist/guild.js +++ b/.dist/guild.js @@ -117,7 +117,7 @@ class Guild { noti ], ["button", "", "submit", _ => { - fetch(this.info.api + "/v9/users/@me/guilds/settings", { + fetch(this.info.api + "/users/@me/guilds/settings", { method: "PATCH", headers: this.headers, body: JSON.stringify({ @@ -211,7 +211,7 @@ class Guild { if (serverbug) { for (const thing of build) { console.log(build, thing); - fetch(this.info.api + "/v9/guilds/" + this.snowflake + "/channels", { + fetch(this.info.api + "/guilds/" + this.snowflake + "/channels", { method: "PATCH", headers: this.headers, body: JSON.stringify([thing]) @@ -219,7 +219,7 @@ class Guild { } } else { - fetch(this.info.api + "/v9/guilds/" + this.snowflake + "/channels", { + fetch(this.info.api + "/guilds/" + this.snowflake + "/channels", { method: "PATCH", headers: this.headers, body: JSON.stringify(build) @@ -361,7 +361,7 @@ class Guild { } } this.unreads(); - fetch(this.info.api + "/v9/read-states/ack-bulk", { + fetch(this.info.api + "/read-states/ack-bulk", { method: "POST", headers: this.headers, body: JSON.stringify(build) diff --git a/.dist/localuser.js b/.dist/localuser.js index 053ee5d..d5f713f 100644 --- a/.dist/localuser.js +++ b/.dist/localuser.js @@ -479,7 +479,7 @@ class Localuser { else { parsed = inviteurl; } - fetch(this.info.api + "/v9/invites/" + parsed, { + fetch(this.info.api + "/invites/" + parsed, { method: "POST", headers: this.headers, }).then(r => r.json()).then(_ => { @@ -502,7 +502,7 @@ class Localuser { content.textContent = "Loading..."; const full = new Fullscreen(["html", content]); full.show(); - const res = await fetch(this.info.api + "/v9/discoverable-guilds?limit=50", { + const res = await fetch(this.info.api + "/discoverable-guilds?limit=50", { headers: this.headers }); const json = await res.json(); @@ -539,7 +539,7 @@ class Localuser { desc.textContent = guild.description; content.appendChild(desc); content.addEventListener("click", async () => { - const joinRes = await fetch(this.info.api + "/v9/guilds/" + guild.id + "/members/@me", { + const joinRes = await fetch(this.info.api + "/guilds/" + guild.id + "/members/@me", { method: "PUT", headers: this.headers }); @@ -617,7 +617,7 @@ class Localuser { }); } updatebio(bio) { - fetch(this.info.api + "/v9/users/@me/profile", { + fetch(this.info.api + "/users/@me/profile", { method: "PATCH", headers: this.headers, body: JSON.stringify({ @@ -810,7 +810,7 @@ class Localuser { connectionContainer ], () => { }, async () => { connectionContainer.innerHTML = ""; - const res = await fetch(this.info.api + "/v9/connections", { + const res = await fetch(this.info.api + "/connections", { headers: this.headers }); const json = await res.json(); @@ -820,7 +820,7 @@ class Localuser { container.textContent = key.charAt(0).toUpperCase() + key.slice(1); if (connection.enabled) { container.addEventListener("click", async () => { - const connectionRes = await fetch(this.info.api + "/v9/connections/" + key + "/authorize", { + const connectionRes = await fetch(this.info.api + "/connections/" + key + "/authorize", { headers: this.headers }); const connectionJSON = await connectionRes.json(); @@ -848,7 +848,7 @@ class Localuser { async () => { if (appName.trim().length == 0) return alert("Please enter a name for the application."); - const res = await fetch(this.info.api + "/v9/applications", { + const res = await fetch(this.info.api + "/applications", { method: "POST", headers: this.headers, body: JSON.stringify({ @@ -866,7 +866,7 @@ class Localuser { ] ], () => { }, async () => { appListContainer.innerHTML = ""; - const res = await fetch(this.info.api + "/v9/applications", { + const res = await fetch(this.info.api + "/applications", { headers: this.headers }); const json = await res.json(); @@ -892,7 +892,7 @@ class Localuser { }); } async manageApplication(appId = "") { - const res = await fetch(this.info.api + "/v9/applications/" + appId, { + const res = await fetch(this.info.api + "/applications/" + appId, { headers: this.headers }); const json = await res.json(); @@ -940,7 +940,7 @@ class Localuser { "", "Save changes", async () => { - const updateRes = await fetch(this.info.api + "/v9/applications/" + appId, { + const updateRes = await fetch(this.info.api + "/applications/" + appId, { method: "PATCH", headers: this.headers, body: JSON.stringify(fields) @@ -960,7 +960,7 @@ class Localuser { if (!json.bot) { if (!confirm("Are you sure you want to add a bot to this application? There's no going back.")) return; - const updateRes = await fetch(this.info.api + "/v9/applications/" + appId + "/bot", { + const updateRes = await fetch(this.info.api + "/applications/" + appId + "/bot", { method: "POST", headers: this.headers }); @@ -976,7 +976,7 @@ class Localuser { appDialog.show(); } async manageBot(appId = "") { - const res = await fetch(this.info.api + "/v9/applications/" + appId, { + const res = await fetch(this.info.api + "/applications/" + appId, { headers: this.headers }); const json = await res.json(); @@ -1010,7 +1010,7 @@ class Localuser { "", "Save changes", async () => { - const updateRes = await fetch(this.info.api + "/v9/applications/" + appId + "/bot", { + const updateRes = await fetch(this.info.api + "/applications/" + appId + "/bot", { method: "PATCH", headers: this.headers, body: JSON.stringify(fields) @@ -1029,7 +1029,7 @@ class Localuser { async () => { if (!confirm("Are you sure you want to reset the bot token? Your bot will stop working until you update it.")) return; - const updateRes = await fetch(this.info.api + "/v9/applications/" + appId + "/bot/reset", { + const updateRes = await fetch(this.info.api + "/applications/" + appId + "/bot/reset", { method: "POST", headers: this.headers }); diff --git a/.dist/member.js b/.dist/member.js index db29fef..e54ebaf 100644 --- a/.dist/member.js +++ b/.dist/member.js @@ -16,7 +16,7 @@ class Member { navigator.clipboard.writeText(this.id); }); this.contextmenu.addbutton("Message user", function () { - fetch(this.info.api + "/v9/users/@me/channels", { method: "POST", + fetch(this.info.api + "/users/@me/channels", { method: "POST", body: JSON.stringify({ "recipients": [this.id] }), headers: this.headers }); diff --git a/.dist/user.js b/.dist/user.js index 2e17f5a..94daec6 100644 --- a/.dist/user.js +++ b/.dist/user.js @@ -48,7 +48,7 @@ class User { navigator.clipboard.writeText(this.id.id); }); this.contextmenu.addbutton("Message user", function () { - fetch(this.info.api + "/v9/users/@me/channels", { method: "POST", + fetch(this.info.api + "/users/@me/channels", { method: "POST", body: JSON.stringify({ "recipients": [this.id.id] }), headers: this.localuser.headers }); @@ -124,7 +124,7 @@ class User { User.contextmenu.bind(html, this); } static async resolve(id, localuser) { - const json = await fetch(localuser.info.api.toString() + "/v9/users/" + id + "/profile", { headers: localuser.headers }).then(_ => _.json()); + const json = await fetch(localuser.info.api.toString() + "/users/" + id + "/profile", { headers: localuser.headers }).then(_ => _.json()); return new User(json, localuser); } changepfp(update) { diff --git a/webpage/guild.ts b/webpage/guild.ts index c4252a2..0d19a92 100644 --- a/webpage/guild.ts +++ b/webpage/guild.ts @@ -128,7 +128,7 @@ class Guild{ noti ], ["button","","submit",_=>{ - fetch(this.info.api+"/v9/users/@me/guilds/settings",{ + fetch(this.info.api+"/users/@me/guilds/settings",{ method:"PATCH", headers:this.headers, body:JSON.stringify({ @@ -221,14 +221,14 @@ class Guild{ if(serverbug){ for(const thing of build){ console.log(build,thing) - fetch(this.info.api+"/v9/guilds/"+this.snowflake+"/channels",{ + fetch(this.info.api+"/guilds/"+this.snowflake+"/channels",{ method:"PATCH", headers:this.headers, body:JSON.stringify([thing]) }); } }else{ - fetch(this.info.api+"/v9/guilds/"+this.snowflake+"/channels",{ + fetch(this.info.api+"/guilds/"+this.snowflake+"/channels",{ method:"PATCH", headers:this.headers, body:JSON.stringify(build) @@ -369,7 +369,7 @@ class Guild{ } } this.unreads(); - fetch(this.info.api+"/v9/read-states/ack-bulk",{ + fetch(this.info.api+"/read-states/ack-bulk",{ method:"POST", headers:this.headers, body:JSON.stringify(build) diff --git a/webpage/localuser.ts b/webpage/localuser.ts index 043be1b..09aed77 100644 --- a/webpage/localuser.ts +++ b/webpage/localuser.ts @@ -493,7 +493,7 @@ class Localuser{ }else{ parsed=inviteurl; } - fetch(this.info.api+"/v9/invites/"+parsed,{ + fetch(this.info.api+"/invites/"+parsed,{ method:"POST", headers:this.headers, }).then(r=>r.json()).then(_=>{ @@ -518,7 +518,7 @@ class Localuser{ const full=new Fullscreen(["html", content]); full.show(); - const res=await fetch(this.info.api+"/v9/discoverable-guilds?limit=50", { + const res=await fetch(this.info.api+"/discoverable-guilds?limit=50", { headers: this.headers }); const json=await res.json(); @@ -562,7 +562,7 @@ class Localuser{ content.appendChild(desc); content.addEventListener("click", async ()=>{ - const joinRes=await fetch(this.info.api+"/v9/guilds/"+guild.id+"/members/@me", { + const joinRes=await fetch(this.info.api+"/guilds/"+guild.id+"/members/@me", { method: "PUT", headers: this.headers }); @@ -637,7 +637,7 @@ class Localuser{ }); } updatebio(bio:string):void{ - fetch(this.info.api+"/v9/users/@me/profile",{ + fetch(this.info.api+"/users/@me/profile",{ method:"PATCH", headers:this.headers, body:JSON.stringify({ @@ -832,7 +832,7 @@ class Localuser{ ], () => {}, async () => { connectionContainer.innerHTML=""; - const res=await fetch(this.info.api+"/v9/connections", { + const res=await fetch(this.info.api+"/connections", { headers: this.headers }); const json=await res.json(); @@ -845,7 +845,7 @@ class Localuser{ if (connection.enabled) { container.addEventListener("click", async () => { - const connectionRes=await fetch(this.info.api+"/v9/connections/" + key + "/authorize", { + const connectionRes=await fetch(this.info.api+"/connections/" + key + "/authorize", { headers: this.headers }); const connectionJSON=await connectionRes.json(); @@ -876,7 +876,7 @@ class Localuser{ async () => { if (appName.trim().length == 0) return alert("Please enter a name for the application."); - const res=await fetch(this.info.api+"/v9/applications", { + const res=await fetch(this.info.api+"/applications", { method: "POST", headers: this.headers, body: JSON.stringify({ @@ -895,7 +895,7 @@ class Localuser{ ], () => {}, async () => { appListContainer.innerHTML=""; - const res=await fetch(this.info.api+"/v9/applications", { + const res=await fetch(this.info.api+"/applications", { headers: this.headers }); const json=await res.json(); @@ -926,7 +926,7 @@ class Localuser{ ) } async manageApplication(appId="") { - const res=await fetch(this.info.api+"/v9/applications/" + appId, { + const res=await fetch(this.info.api+"/applications/" + appId, { headers: this.headers }); const json=await res.json(); @@ -976,7 +976,7 @@ class Localuser{ "", "Save changes", async () => { - const updateRes=await fetch(this.info.api+"/v9/applications/" + appId, { + const updateRes=await fetch(this.info.api+"/applications/" + appId, { method: "PATCH", headers: this.headers, body: JSON.stringify(fields) @@ -995,7 +995,7 @@ class Localuser{ if (!json.bot) { if (!confirm("Are you sure you want to add a bot to this application? There's no going back.")) return; - const updateRes=await fetch(this.info.api+"/v9/applications/" + appId + "/bot", { + const updateRes=await fetch(this.info.api+"/applications/" + appId + "/bot", { method: "POST", headers: this.headers }); @@ -1013,7 +1013,7 @@ class Localuser{ appDialog.show(); } async manageBot(appId="") { - const res=await fetch(this.info.api+"/v9/applications/" + appId, { + const res=await fetch(this.info.api+"/applications/" + appId, { headers: this.headers }); const json=await res.json(); @@ -1048,7 +1048,7 @@ class Localuser{ "", "Save changes", async () => { - const updateRes=await fetch(this.info.api+"/v9/applications/" + appId + "/bot", { + const updateRes=await fetch(this.info.api+"/applications/" + appId + "/bot", { method: "PATCH", headers: this.headers, body: JSON.stringify(fields) @@ -1066,7 +1066,7 @@ class Localuser{ async () => { if (!confirm("Are you sure you want to reset the bot token? Your bot will stop working until you update it.")) return; - const updateRes=await fetch(this.info.api+"/v9/applications/" + appId + "/bot/reset", { + const updateRes=await fetch(this.info.api+"/applications/" + appId + "/bot/reset", { method: "POST", headers: this.headers }); diff --git a/webpage/member.ts b/webpage/member.ts index 17a9e43..bf4086f 100644 --- a/webpage/member.ts +++ b/webpage/member.ts @@ -18,7 +18,7 @@ class Member{ navigator.clipboard.writeText(this.id); }); this.contextmenu.addbutton("Message user",function(){ - fetch(this.info.api+"/v9/users/@me/channels", + fetch(this.info.api+"/users/@me/channels", {method:"POST", body:JSON.stringify({"recipients":[this.id]}), headers: this.headers diff --git a/webpage/user.ts b/webpage/user.ts index f2bdd8c..5073c2c 100644 --- a/webpage/user.ts +++ b/webpage/user.ts @@ -52,7 +52,7 @@ class User{ navigator.clipboard.writeText(this.id.id); }); this.contextmenu.addbutton("Message user",function(){ - fetch(this.info.api+"/v9/users/@me/channels", + fetch(this.info.api+"/users/@me/channels", {method:"POST", body:JSON.stringify({"recipients":[this.id.id]}), headers: this.localuser.headers @@ -125,7 +125,7 @@ class User{ User.contextmenu.bind(html,this); } static async resolve(id:string,localuser:Localuser){ - const json=await fetch(localuser.info.api.toString()+"/v9/users/"+id+"/profile", + const json=await fetch(localuser.info.api.toString()+"/users/"+id+"/profile", {headers:localuser.headers} ).then(_=>_.json()); return new User(json,localuser);