From 6319d023e81f43ca1cf81805c0986b031228a790 Mon Sep 17 00:00:00 2001 From: vi Date: Sun, 15 May 2022 12:56:43 -0400 Subject: [PATCH 1/5] typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4de1409..80774f0 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ git clone https://github.com/discord/discord-example-app.git Then navigate to its directory and install dependencies: ``` -cd discord-getting-started +cd discord-example-app npm install ``` ### Get app credentials From d5251bedbc3e010bc2c2bc5a50b5fcdd6e5c0f7b Mon Sep 17 00:00:00 2001 From: vi Date: Sun, 15 May 2022 15:13:10 -0400 Subject: [PATCH 2/5] add user-agent (fixes #4) --- utils.js | 1 + 1 file changed, 1 insertion(+) diff --git a/utils.js b/utils.js index 578617c..2620427 100644 --- a/utils.js +++ b/utils.js @@ -25,6 +25,7 @@ export async function DiscordRequest(endpoint, options) { headers: { Authorization: `Bot ${process.env.DISCORD_TOKEN}`, 'Content-Type': 'application/json; charset=UTF-8', + 'User-Agent': 'Mozilla/5.0 (compatible; Discordbot/2.0; +https://discordapp.com)', }, ...options }); From 1a061508567e2c447c051058d178d6060d081b89 Mon Sep 17 00:00:00 2001 From: vi Date: Mon, 16 May 2022 19:22:17 -0400 Subject: [PATCH 3/5] update api version + fix user agent --- utils.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils.js b/utils.js index 2620427..aa8ff53 100644 --- a/utils.js +++ b/utils.js @@ -17,7 +17,7 @@ export function VerifyDiscordRequest(clientKey) { export async function DiscordRequest(endpoint, options) { // append endpoint to root API URL - const url = 'https://discord.com/api/v9/' + endpoint; + const url = 'https://discord.com/api/v10/' + endpoint; // Stringify payloads if (options.body) options.body = JSON.stringify(options.body); // Use node-fetch to make requests @@ -25,7 +25,7 @@ export async function DiscordRequest(endpoint, options) { headers: { Authorization: `Bot ${process.env.DISCORD_TOKEN}`, 'Content-Type': 'application/json; charset=UTF-8', - 'User-Agent': 'Mozilla/5.0 (compatible; Discordbot/2.0; +https://discordapp.com)', + 'User-Agent': 'DiscordBot (https://github.com/discord/discord-example-app, null)', }, ...options }); From 3f0bfddf5ca1a36c01a1da85ba1378ee3b09554c Mon Sep 17 00:00:00 2001 From: tcrms Date: Tue, 17 May 2022 03:35:00 -0400 Subject: [PATCH 4/5] fix, again Co-authored-by: Splatterxl --- utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils.js b/utils.js index aa8ff53..b3efc5e 100644 --- a/utils.js +++ b/utils.js @@ -25,7 +25,7 @@ export async function DiscordRequest(endpoint, options) { headers: { Authorization: `Bot ${process.env.DISCORD_TOKEN}`, 'Content-Type': 'application/json; charset=UTF-8', - 'User-Agent': 'DiscordBot (https://github.com/discord/discord-example-app, null)', + 'User-Agent': 'DiscordBot (https://github.com/discord/discord-example-app, 0.0.0)', }, ...options }); From a7c91271ae4cf7dc70ceb64e9b3f5f1fb41e60d3 Mon Sep 17 00:00:00 2001 From: tcrms Date: Tue, 17 May 2022 03:36:42 -0400 Subject: [PATCH 5/5] make the version match with `package.json` --- utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils.js b/utils.js index b3efc5e..d7b2881 100644 --- a/utils.js +++ b/utils.js @@ -25,7 +25,7 @@ export async function DiscordRequest(endpoint, options) { headers: { Authorization: `Bot ${process.env.DISCORD_TOKEN}`, 'Content-Type': 'application/json; charset=UTF-8', - 'User-Agent': 'DiscordBot (https://github.com/discord/discord-example-app, 0.0.0)', + 'User-Agent': 'DiscordBot (https://github.com/discord/discord-example-app, 1.0.0)', }, ...options });