From fc7f02e85b39ac2a4a951ca6f2a43dab30dd56d3 Mon Sep 17 00:00:00 2001 From: March 7th <71698422+aiko-chan-ai@users.noreply.github.com> Date: Sat, 14 May 2022 12:12:10 +0700 Subject: [PATCH] Fix Webhook send #108 DiscordAPIError: Invalid request origin --- src/structures/Webhook.js | 1 + src/util/Options.js | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/structures/Webhook.js b/src/structures/Webhook.js index af92b0b..f8c27f0 100644 --- a/src/structures/Webhook.js +++ b/src/structures/Webhook.js @@ -198,6 +198,7 @@ class Webhook { files, query: { thread_id: messagePayload.options.threadId, wait: true }, auth: false, + versioned: true, }); return this.client.channels?.cache.get(d.channel_id)?.messages._add(d, false) ?? d; } diff --git a/src/util/Options.js b/src/util/Options.js index a49911d..24d68f4 100644 --- a/src/util/Options.js +++ b/src/util/Options.js @@ -191,11 +191,10 @@ class Options extends null { http: { headers: { Accept: '*/*', - // 'Accept-Encoding': 'gzip, deflate, br', => cause axios bug 'Accept-Language': 'en-US,en;q=0.9', 'Cache-Control': 'no-cache', Pragma: 'no-cache', - Referer: 'https://discord.com/channels/@me', + // Referer: 'https://discord.com/channels/@me', 'Sec-Ch-Ua': '"Not A;Brand";v="99", "Chromium";v="100", "Google Chrome";v="100', 'Sec-Ch-Ua-Mobile': '?0', 'Sec-Ch-Ua-Platform': '"Windows"', @@ -219,7 +218,7 @@ class Options extends null { 'ascii', ).toString('base64')}`, 'X-Discord-Locale': 'en-US', - Origin: 'https://discord.com', + // Origin: 'https://discord.com', Webhook Error 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) discord/1.0.9004 Chrome/91.0.4472.164 Electron/13.6.6 Safari/537.36', },