| @@ -9,7 +9,7 @@ namespace Discord.API | |||||
| [JsonProperty("username")] | [JsonProperty("username")] | ||||
| public string Username { get; set; } | public string Username { get; set; } | ||||
| [JsonProperty("discriminator")] | [JsonProperty("discriminator")] | ||||
| public ushort Discriminator { get; set; } | |||||
| public string Discriminator { get; set; } | |||||
| [JsonProperty("avatar")] | [JsonProperty("avatar")] | ||||
| public string Avatar { get; set; } | public string Avatar { get; set; } | ||||
| [JsonProperty("verified")] | [JsonProperty("verified")] | ||||
| @@ -994,10 +994,11 @@ namespace Discord.API | |||||
| } | } | ||||
| catch (HttpException ex) when (ex.StatusCode == HttpStatusCode.NotFound) { return null; } | catch (HttpException ex) when (ex.StatusCode == HttpStatusCode.NotFound) { return null; } | ||||
| } | } | ||||
| public async Task<User> GetUser(string username, ushort discriminator, RequestOptions options = null) | |||||
| public async Task<User> GetUser(string username, string discriminator, RequestOptions options = null) | |||||
| { | { | ||||
| Preconditions.NotNullOrEmpty(username, nameof(username)); | Preconditions.NotNullOrEmpty(username, nameof(username)); | ||||
| Preconditions.NotNullOrEmpty(discriminator, nameof(discriminator)); | |||||
| try | try | ||||
| { | { | ||||
| var models = await QueryUsers($"{username}#{discriminator}", 1, options: options).ConfigureAwait(false); | var models = await QueryUsers($"{username}#{discriminator}", 1, options: options).ConfigureAwait(false); | ||||
| @@ -3,8 +3,6 @@ using Discord.Extensions; | |||||
| using Discord.Logging; | using Discord.Logging; | ||||
| using Discord.Net; | using Discord.Net; | ||||
| using Discord.Net.Queue; | using Discord.Net.Queue; | ||||
| using Discord.Net.Rest; | |||||
| using Discord.Net.WebSockets; | |||||
| using System; | using System; | ||||
| using System.Collections.Generic; | using System.Collections.Generic; | ||||
| using System.Collections.Immutable; | using System.Collections.Immutable; | ||||
| @@ -190,7 +188,7 @@ namespace Discord | |||||
| return new User(this, model); | return new User(this, model); | ||||
| return null; | return null; | ||||
| } | } | ||||
| public virtual async Task<IUser> GetUser(string username, ushort discriminator) | |||||
| public virtual async Task<IUser> GetUser(string username, string discriminator) | |||||
| { | { | ||||
| var model = await ApiClient.GetUser(username, discriminator).ConfigureAwait(false); | var model = await ApiClient.GetUser(username, discriminator).ConfigureAwait(false); | ||||
| if (model != null) | if (model != null) | ||||
| @@ -95,7 +95,7 @@ namespace Discord | |||||
| _gatewayLogger = _log.CreateLogger("Gateway"); | _gatewayLogger = _log.CreateLogger("Gateway"); | ||||
| _serializer = new JsonSerializer { ContractResolver = new DiscordContractResolver() }; | _serializer = new JsonSerializer { ContractResolver = new DiscordContractResolver() }; | ||||
| ApiClient.SentGatewayMessage += async opCode => await _gatewayLogger.Verbose($"Sent Op {(GatewayOpCode)opCode}"); | ApiClient.SentGatewayMessage += async opCode => await _gatewayLogger.Verbose($"Sent Op {(GatewayOpCode)opCode}"); | ||||
| ApiClient.ReceivedGatewayEvent += ProcessMessage; | ApiClient.ReceivedGatewayEvent += ProcessMessage; | ||||
| GatewaySocket = config.WebSocketProvider(); | GatewaySocket = config.WebSocketProvider(); | ||||
| @@ -262,7 +262,7 @@ namespace Discord | |||||
| { | { | ||||
| return Task.FromResult<IUser>(DataStore.GetUser(id)); | return Task.FromResult<IUser>(DataStore.GetUser(id)); | ||||
| } | } | ||||
| public override Task<IUser> GetUser(string username, ushort discriminator) | |||||
| public override Task<IUser> GetUser(string username, string discriminator) | |||||
| { | { | ||||
| return Task.FromResult<IUser>(DataStore.Users.Where(x => x.Discriminator == discriminator && x.Username == username).FirstOrDefault()); | return Task.FromResult<IUser>(DataStore.Users.Where(x => x.Discriminator == discriminator && x.Username == username).FirstOrDefault()); | ||||
| } | } | ||||
| @@ -23,7 +23,7 @@ namespace Discord | |||||
| public ulong Id => User.Id; | public ulong Id => User.Id; | ||||
| public string AvatarUrl => User.AvatarUrl; | public string AvatarUrl => User.AvatarUrl; | ||||
| public DateTime CreatedAt => User.CreatedAt; | public DateTime CreatedAt => User.CreatedAt; | ||||
| public ushort Discriminator => User.Discriminator; | |||||
| public string Discriminator => User.Discriminator; | |||||
| public Game? Game => User.Game; | public Game? Game => User.Game; | ||||
| public bool IsAttached => User.IsAttached; | public bool IsAttached => User.IsAttached; | ||||
| public bool IsBot => User.IsBot; | public bool IsBot => User.IsBot; | ||||
| @@ -7,7 +7,7 @@ namespace Discord | |||||
| /// <summary> Gets the url to this user's avatar. </summary> | /// <summary> Gets the url to this user's avatar. </summary> | ||||
| string AvatarUrl { get; } | string AvatarUrl { get; } | ||||
| /// <summary> Gets the per-username unique id for this user. </summary> | /// <summary> Gets the per-username unique id for this user. </summary> | ||||
| ushort Discriminator { get; } | |||||
| string Discriminator { get; } | |||||
| /// <summary> Returns true if this user is a bot account. </summary> | /// <summary> Returns true if this user is a bot account. </summary> | ||||
| bool IsBot { get; } | bool IsBot { get; } | ||||
| /// <summary> Gets the username for this user. </summary> | /// <summary> Gets the username for this user. </summary> | ||||
| @@ -10,7 +10,7 @@ namespace Discord | |||||
| { | { | ||||
| private string _avatarId; | private string _avatarId; | ||||
| public ushort Discriminator { get; private set; } | |||||
| public string Discriminator { get; private set; } | |||||
| public bool IsBot { get; private set; } | public bool IsBot { get; private set; } | ||||
| public string Username { get; private set; } | public string Username { get; private set; } | ||||
| @@ -31,7 +31,7 @@ namespace Discord | |||||
| Task<IInvite> GetInvite(string inviteIdOrXkcd); | Task<IInvite> GetInvite(string inviteIdOrXkcd); | ||||
| Task<IUser> GetUser(ulong id); | Task<IUser> GetUser(ulong id); | ||||
| Task<IUser> GetUser(string username, ushort discriminator); | |||||
| Task<IUser> GetUser(string username, string discriminator); | |||||
| Task<ISelfUser> GetCurrentUser(); | Task<ISelfUser> GetCurrentUser(); | ||||
| Task<IReadOnlyCollection<IUser>> QueryUsers(string query, int limit); | Task<IReadOnlyCollection<IUser>> QueryUsers(string query, int limit); | ||||