diff --git a/README.md b/README.md
index 0f82cc76ce..893c3471b9 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,5 @@
# Discord.Net v0.9.4
-[![NuGet Pre Release](https://img.shields.io/nuget/vpre/Discord.Net.svg?maxAge=2592000?style=plastic)](https://www.nuget.org/packages/Discord.Net) [![Discord](https://discordapp.com/api/servers/81384788765712384/widget.png)](https://discord.gg/0SBTUU1wZTYLhAAW)
+[![NuGet Pre Release](https://img.shields.io/nuget/vpre/Discord.Net.svg?maxAge=2592000?style=plastic)](https://www.nuget.org/packages/Discord.Net) [![Discord](https://discordapp.com/api/guilds/81384788765712384/widget.png)](https://discord.gg/0SBTUU1wZTYLhAAW)
An unofficial .Net API Wrapper for the Discord client (http://discordapp.com).
diff --git a/src/Discord.Net.Net45/Discord.Net.csproj b/src/Discord.Net.Net45/Discord.Net.csproj
index 8cb0cb65e8..359f650a38 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 0000000000..6ffeaffd02
--- /dev/null
+++ b/src/Discord.Net.Net45/Enums/TokenType.cs
@@ -0,0 +1,10 @@
+using System;
+
+namespace Discord
+{
+ public enum TokenType
+ {
+ User,
+ Bot,
+ }
+}
diff --git a/src/Discord.Net/DiscordClient.cs b/src/Discord.Net/DiscordClient.cs
index 0629f82e15..9dacfe71a5 100644
--- a/src/Discord.Net/DiscordClient.cs
+++ b/src/Discord.Net/DiscordClient.cs
@@ -169,14 +169,14 @@ public async Task Connect(string email, string password, string token =
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,17 @@ private async Task BeginConnect(string email, string password, string token = nu
ClientAPI.CancelToken = CancelToken;
StatusAPI.CancelToken = CancelToken;
+ switch (tokenType)
+ {
+ case TokenType.Bot:
+ token = $"Bot {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);