mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2026-04-28 08:46:44 +00:00
Change how user token is sent in requests
This commit is contained in:
@@ -32,13 +32,10 @@ namespace DiscordChatExporter.Core.Services
|
|||||||
const string apiRoot = "https://discordapp.com/api/v6";
|
const string apiRoot = "https://discordapp.com/api/v6";
|
||||||
using (var request = new HttpRequestMessage(HttpMethod.Get, $"{apiRoot}/{resource}/{endpoint}"))
|
using (var request = new HttpRequestMessage(HttpMethod.Get, $"{apiRoot}/{resource}/{endpoint}"))
|
||||||
{
|
{
|
||||||
// Add url parameter for the user token
|
// Set authorization header
|
||||||
if (token.Type == AuthTokenType.User)
|
request.Headers.Authorization = token.Type == AuthTokenType.User
|
||||||
request.RequestUri = request.RequestUri.SetQueryParameter("token", token.Value);
|
? new AuthenticationHeaderValue(token.Value)
|
||||||
|
: new AuthenticationHeaderValue("Bot", token.Value);
|
||||||
// Add header for the bot token
|
|
||||||
if (token.Type == AuthTokenType.Bot)
|
|
||||||
request.Headers.Authorization = new AuthenticationHeaderValue("Bot", token.Value);
|
|
||||||
|
|
||||||
// Add parameters
|
// Add parameters
|
||||||
foreach (var parameter in parameters)
|
foreach (var parameter in parameters)
|
||||||
|
|||||||
Reference in New Issue
Block a user