Fix Webhook send #108

DiscordAPIError: Invalid request origin
This commit is contained in:
March 7th 2022-05-14 12:12:10 +07:00
parent 9c8d53076c
commit fc7f02e85b
2 changed files with 3 additions and 3 deletions

View File

@ -198,6 +198,7 @@ class Webhook {
files, files,
query: { thread_id: messagePayload.options.threadId, wait: true }, query: { thread_id: messagePayload.options.threadId, wait: true },
auth: false, auth: false,
versioned: true,
}); });
return this.client.channels?.cache.get(d.channel_id)?.messages._add(d, false) ?? d; return this.client.channels?.cache.get(d.channel_id)?.messages._add(d, false) ?? d;
} }

View File

@ -191,11 +191,10 @@ class Options extends null {
http: { http: {
headers: { headers: {
Accept: '*/*', Accept: '*/*',
// 'Accept-Encoding': 'gzip, deflate, br', => cause axios bug
'Accept-Language': 'en-US,en;q=0.9', 'Accept-Language': 'en-US,en;q=0.9',
'Cache-Control': 'no-cache', 'Cache-Control': 'no-cache',
Pragma: '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': '"Not A;Brand";v="99", "Chromium";v="100", "Google Chrome";v="100',
'Sec-Ch-Ua-Mobile': '?0', 'Sec-Ch-Ua-Mobile': '?0',
'Sec-Ch-Ua-Platform': '"Windows"', 'Sec-Ch-Ua-Platform': '"Windows"',
@ -219,7 +218,7 @@ class Options extends null {
'ascii', 'ascii',
).toString('base64')}`, ).toString('base64')}`,
'X-Discord-Locale': 'en-US', 'X-Discord-Locale': 'en-US',
Origin: 'https://discord.com', // Origin: 'https://discord.com', Webhook Error
'User-Agent': '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', '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',
}, },