diff --git a/src/Discord.Net/API/Client/Rest/Login.cs b/src/Discord.Net/API/Client/Rest/Login.cs index 70e5e46a0..f4b0b0c92 100644 --- a/src/Discord.Net/API/Client/Rest/Login.cs +++ b/src/Discord.Net/API/Client/Rest/Login.cs @@ -5,14 +5,14 @@ namespace Discord.API.Client.Rest [JsonObject(MemberSerialization.OptIn)] public sealed class LoginRequest : IRestRequest { - string IRestRequest.Method => "POST"; + string IRestRequest.Method => Email != null ? "POST" : "GET"; string IRestRequest.Endpoint => $"auth/login"; object IRestRequest.Payload => this; bool IRestRequest.IsPrivate => false; - [JsonProperty("email")] + [JsonProperty("email", NullValueHandling = NullValueHandling.Ignore)] public string Email { get; set; } - [JsonProperty("password")] + [JsonProperty("password", NullValueHandling = NullValueHandling.Ignore)] public string Password { get; set; } } diff --git a/src/Discord.Net/DiscordClient.cs b/src/Discord.Net/DiscordClient.cs index 0074e89f8..443497ca5 100644 --- a/src/Discord.Net/DiscordClient.cs +++ b/src/Discord.Net/DiscordClient.cs @@ -168,13 +168,13 @@ namespace Discord await BeginConnect(email, password, null).ConfigureAwait(false); return ClientAPI.Token; } - /*/// Connects to the Discord server with the provided token. + /// Connects to the Discord server with the provided token. public async Task Connect(string token) { if (token == null) throw new ArgumentNullException(token); await BeginConnect(null, null, token).ConfigureAwait(false); - }*/ + } private async Task BeginConnect(string email, string password, string token = null) { @@ -222,7 +222,7 @@ namespace Discord throw; } } - private async Task Login(string email, string password, string token = null) + private async Task Login(string email = null, string password = null, string token = null) { string tokenPath = null, oldToken = null; byte[] cacheKey = null; diff --git a/src/Discord.Net/Models/Message.cs b/src/Discord.Net/Models/Message.cs index 3d3fc946a..9e66111a2 100644 --- a/src/Discord.Net/Models/Message.cs +++ b/src/Discord.Net/Models/Message.cs @@ -208,7 +208,7 @@ namespace Discord /// Returns if this message was sent from the logged-in accounts. public bool IsAuthor => User != null && User.Id == Client.CurrentUser?.Id; - internal Message(ulong id, Channel channel, User user) + internal Message(ulong id, Channel channel, User user) { Id = id; Channel = channel;