You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
667 B
27 lines
667 B
using System.Net.Http.Headers;
|
|
|
|
namespace DiscordChatExporter.Core.Discord
|
|
{
|
|
public enum AuthTokenType { User, Bot }
|
|
|
|
public class AuthToken
|
|
{
|
|
public AuthTokenType Type { get; }
|
|
|
|
public string Value { get; }
|
|
|
|
public AuthToken(AuthTokenType type, string value)
|
|
{
|
|
Type = type;
|
|
Value = value;
|
|
}
|
|
|
|
public AuthenticationHeaderValue GetAuthenticationHeader() => Type switch
|
|
{
|
|
AuthTokenType.Bot => new AuthenticationHeaderValue("Bot", Value),
|
|
_ => new AuthenticationHeaderValue(Value)
|
|
};
|
|
|
|
public override string ToString() => Value;
|
|
}
|
|
} |