Implemented emoji endpoints (#835)
* Implemented emoji endpoints. * Fixed: now using API entities for REST client. * Removed emoji listing endpoint, as per @foxbot's request.
This commit is contained in:
committed by
Christopher F
parent
cf8de42b62
commit
b4bf046ad4
@@ -1066,6 +1066,50 @@ namespace Discord.API
|
||||
return await SendJsonAsync<IReadOnlyCollection<Role>>("PATCH", () => $"guilds/{guildId}/roles", args, ids, options: options).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
//Guild emoji
|
||||
public async Task<Emoji> GetGuildEmoteAsync(ulong guildId, ulong emoteId, RequestOptions options = null)
|
||||
{
|
||||
Preconditions.NotEqual(guildId, 0, nameof(guildId));
|
||||
Preconditions.NotEqual(emoteId, 0, nameof(emoteId));
|
||||
options = RequestOptions.CreateOrClone(options);
|
||||
|
||||
var ids = new BucketIds(guildId: guildId);
|
||||
return await SendAsync<Emoji>("GET", () => $"guilds/{guildId}/emojis/{emoteId}", ids, options: options);
|
||||
}
|
||||
|
||||
public async Task<Emoji> CreateGuildEmoteAsync(ulong guildId, Rest.CreateGuildEmoteParams args, RequestOptions options = null)
|
||||
{
|
||||
Preconditions.NotEqual(guildId, 0, nameof(guildId));
|
||||
Preconditions.NotNull(args, nameof(args));
|
||||
Preconditions.NotNullOrWhitespace(args.Name, nameof(args.Name));
|
||||
Preconditions.NotNull(args.Image.Stream, nameof(args.Image));
|
||||
options = RequestOptions.CreateOrClone(options);
|
||||
|
||||
var ids = new BucketIds(guildId: guildId);
|
||||
return await SendJsonAsync<Emoji>("POST", () => $"guilds/{guildId}/emojis", args, ids, options: options);
|
||||
}
|
||||
|
||||
public async Task<Emoji> ModifyGuildEmoteAsync(ulong guildId, ulong emoteId, ModifyGuildEmoteParams args, RequestOptions options = null)
|
||||
{
|
||||
Preconditions.NotEqual(guildId, 0, nameof(guildId));
|
||||
Preconditions.NotEqual(emoteId, 0, nameof(emoteId));
|
||||
Preconditions.NotNull(args, nameof(args));
|
||||
options = RequestOptions.CreateOrClone(options);
|
||||
|
||||
var ids = new BucketIds(guildId: guildId);
|
||||
return await SendJsonAsync<Emoji>("PATCH", () => $"guilds/{guildId}/emojis/{emoteId}", args, ids, options: options);
|
||||
}
|
||||
|
||||
public async Task DeleteGuildEmoteAsync(ulong guildId, ulong emoteId, RequestOptions options = null)
|
||||
{
|
||||
Preconditions.NotEqual(guildId, 0, nameof(guildId));
|
||||
Preconditions.NotEqual(emoteId, 0, nameof(emoteId));
|
||||
options = RequestOptions.CreateOrClone(options);
|
||||
|
||||
var ids = new BucketIds(guildId: guildId);
|
||||
await SendAsync("DELETE", () => $"guilds/{guildId}/emojis/{emoteId}", ids, options: options);
|
||||
}
|
||||
|
||||
//Users
|
||||
public async Task<User> GetUserAsync(ulong userId, RequestOptions options = null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user