Added CommandContext, fixed commands compile errors

This commit is contained in:
RogueException
2016-10-04 09:54:44 -03:00
parent 8aa1050b93
commit 708f9fe514
32 changed files with 187 additions and 148 deletions

View File

@@ -856,27 +856,6 @@ namespace Discord.API
}
catch (HttpException ex) when (ex.StatusCode == HttpStatusCode.NotFound) { return null; }
}
public async Task<User> GetUserAsync(string username, string discriminator, RequestOptions options = null)
{
Preconditions.NotNullOrEmpty(username, nameof(username));
Preconditions.NotNullOrEmpty(discriminator, nameof(discriminator));
options = RequestOptions.CreateOrClone(options);
try
{
var models = await QueryUsersAsync($"{username}#{discriminator}", 1, options: options).ConfigureAwait(false);
return models.FirstOrDefault();
}
catch (HttpException ex) when (ex.StatusCode == HttpStatusCode.NotFound) { return null; }
}
public async Task<IReadOnlyCollection<User>> QueryUsersAsync(string query, int limit, RequestOptions options = null)
{
Preconditions.NotNullOrEmpty(query, nameof(query));
Preconditions.AtLeast(limit, 0, nameof(limit));
options = RequestOptions.CreateOrClone(options);
return await SendAsync<IReadOnlyCollection<User>>("GET", $"users?q={Uri.EscapeDataString(query)}&limit={limit}", options: options).ConfigureAwait(false);
}
//Current User/DMs
public async Task<User> GetMyUserAsync(RequestOptions options = null)

View File

@@ -12,6 +12,7 @@ namespace Discord
DateTimeOffset? JoinedAt { get; }
/// <summary> Gets the nickname for this user. </summary>
string Nickname { get; }
GuildPermissions GuildPermissions { get; }
/// <summary> Gets the id of the guild for this user. </summary>
ulong GuildId { get; }

View File

@@ -19,18 +19,18 @@ namespace Discord
Task<IApplication> GetApplicationInfoAsync();
Task<IChannel> GetChannelAsync(ulong id);
Task<IReadOnlyCollection<IPrivateChannel>> GetPrivateChannelsAsync();
Task<IChannel> GetChannelAsync(ulong id, CacheMode mode = CacheMode.AllowDownload);
Task<IReadOnlyCollection<IPrivateChannel>> GetPrivateChannelsAsync(CacheMode mode = CacheMode.AllowDownload);
Task<IReadOnlyCollection<IConnection>> GetConnectionsAsync();
Task<IGuild> GetGuildAsync(ulong id);
Task<IReadOnlyCollection<IGuild>> GetGuildsAsync();
Task<IGuild> GetGuildAsync(ulong id, CacheMode mode = CacheMode.AllowDownload);
Task<IReadOnlyCollection<IGuild>> GetGuildsAsync(CacheMode mode = CacheMode.AllowDownload);
Task<IGuild> CreateGuildAsync(string name, IVoiceRegion region, Stream jpegIcon = null);
Task<IInvite> GetInviteAsync(string inviteId);
Task<IUser> GetUserAsync(ulong id);
Task<IUser> GetUserAsync(ulong id, CacheMode mode = CacheMode.AllowDownload);
Task<IUser> GetUserAsync(string username, string discriminator);
Task<IReadOnlyCollection<IVoiceRegion>> GetVoiceRegionsAsync();