Added CommandContext, fixed commands compile errors
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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; }
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user