diff --git a/src/Discord.Net.Net45/Discord.Net.csproj b/src/Discord.Net.Net45/Discord.Net.csproj
index 8cb0cb65e..359f650a3 100644
--- a/src/Discord.Net.Net45/Discord.Net.csproj
+++ b/src/Discord.Net.Net45/Discord.Net.csproj
@@ -611,6 +611,7 @@
TaskManager.cs
+
diff --git a/src/Discord.Net.Net45/Enums/TokenType.cs b/src/Discord.Net.Net45/Enums/TokenType.cs
new file mode 100644
index 000000000..72f257aad
--- /dev/null
+++ b/src/Discord.Net.Net45/Enums/TokenType.cs
@@ -0,0 +1,11 @@
+using System;
+
+namespace Discord
+{
+ public enum TokenType
+ {
+ User,
+ Bearer,
+ Bot,
+ }
+}
diff --git a/src/Discord.Net/DiscordClient.cs b/src/Discord.Net/DiscordClient.cs
index 0629f82e1..bbbd5b539 100644
--- a/src/Discord.Net/DiscordClient.cs
+++ b/src/Discord.Net/DiscordClient.cs
@@ -169,14 +169,14 @@ namespace Discord
return ClientAPI.Token;
}
/// Connects to the Discord server with the provided token.
- public async Task Connect(string token)
+ public async Task Connect(string token, TokenType tokenType)
{
if (token == null) throw new ArgumentNullException(token);
- await BeginConnect(null, null, token).ConfigureAwait(false);
+ await BeginConnect(null, null, token, tokenType).ConfigureAwait(false);
}
- private async Task BeginConnect(string email, string password, string token = null)
+ private async Task BeginConnect(string email, string password, string token = null, TokenType tokenType = TokenType.User)
{
try
{
@@ -199,6 +199,20 @@ namespace Discord
ClientAPI.CancelToken = CancelToken;
StatusAPI.CancelToken = CancelToken;
+ switch (tokenType)
+ {
+ case TokenType.Bot:
+ token = $"Bot {token}";
+ break;
+ case TokenType.Bearer:
+ token = $"Bearer {token}";
+ break;
+ case TokenType.User:
+ break;
+ default:
+ throw new ArgumentException("Unknown oauth token type", nameof(tokenType));
+ }
+
await Login(email, password, token).ConfigureAwait(false);
await GatewaySocket.Connect(ClientAPI, CancelToken).ConfigureAwait(false);