| @@ -892,6 +892,15 @@ namespace Discord | |||||
| /// </returns> | /// </returns> | ||||
| Task<IReadOnlyCollection<IWebhook>> GetWebhooksAsync(RequestOptions options = null); | Task<IReadOnlyCollection<IWebhook>> GetWebhooksAsync(RequestOptions options = null); | ||||
| /// <summary> | |||||
| /// Gets a collection of emotes from this guild. | |||||
| /// </summary> | |||||
| /// <param name="options">The options to be used when sending the request.</param> | |||||
| /// <returns> | |||||
| /// A task that represents the asynchronous get operation. The task result contains a read-only collection | |||||
| /// of emotes found within the guild. | |||||
| /// </returns> | |||||
| Task<IReadOnlyCollection<GuildEmote>> GetEmotesAsync(RequestOptions options = null); | |||||
| /// <summary> | /// <summary> | ||||
| /// Gets a specific emote from this guild. | /// Gets a specific emote from this guild. | ||||
| /// </summary> | /// </summary> | ||||
| @@ -1280,6 +1280,15 @@ namespace Discord.API | |||||
| } | } | ||||
| //Guild emoji | //Guild emoji | ||||
| public async Task<IReadOnlyCollection<Emoji>> GetGuildEmotesAsync(ulong guildId, RequestOptions options = null) | |||||
| { | |||||
| Preconditions.NotEqual(guildId, 0, nameof(guildId)); | |||||
| options = RequestOptions.CreateOrClone(options); | |||||
| var ids = new BucketIds(guildId: guildId); | |||||
| return await SendAsync<IReadOnlyCollection<Emoji>>("GET", () => $"guilds/{guildId}/emojis", ids, options: options).ConfigureAwait(false); | |||||
| } | |||||
| public async Task<Emoji> GetGuildEmoteAsync(ulong guildId, ulong emoteId, RequestOptions options = null) | public async Task<Emoji> GetGuildEmoteAsync(ulong guildId, ulong emoteId, RequestOptions options = null) | ||||
| { | { | ||||
| Preconditions.NotEqual(guildId, 0, nameof(guildId)); | Preconditions.NotEqual(guildId, 0, nameof(guildId)); | ||||
| @@ -496,6 +496,11 @@ namespace Discord.Rest | |||||
| } | } | ||||
| //Emotes | //Emotes | ||||
| public static async Task<IReadOnlyCollection<GuildEmote>> GetEmotesAsync(IGuild guild, BaseDiscordClient client, RequestOptions options) | |||||
| { | |||||
| var models = await client.ApiClient.GetGuildEmotesAsync(guild.Id, options).ConfigureAwait(false); | |||||
| return models.Select(x => x.ToEntity()).ToImmutableArray(); | |||||
| } | |||||
| public static async Task<GuildEmote> GetEmoteAsync(IGuild guild, BaseDiscordClient client, ulong id, RequestOptions options) | public static async Task<GuildEmote> GetEmoteAsync(IGuild guild, BaseDiscordClient client, ulong id, RequestOptions options) | ||||
| { | { | ||||
| var emote = await client.ApiClient.GetGuildEmoteAsync(guild.Id, id, options).ConfigureAwait(false); | var emote = await client.ApiClient.GetGuildEmoteAsync(guild.Id, id, options).ConfigureAwait(false); | ||||
| @@ -828,6 +828,9 @@ namespace Discord.Rest | |||||
| //Emotes | //Emotes | ||||
| /// <inheritdoc /> | /// <inheritdoc /> | ||||
| public Task<IReadOnlyCollection<GuildEmote>> GetEmotesAsync(RequestOptions options = null) | |||||
| => GuildHelper.GetEmotesAsync(this, Discord, options); | |||||
| /// <inheritdoc /> | |||||
| public Task<GuildEmote> GetEmoteAsync(ulong id, RequestOptions options = null) | public Task<GuildEmote> GetEmoteAsync(ulong id, RequestOptions options = null) | ||||
| => GuildHelper.GetEmoteAsync(this, Discord, id, options); | => GuildHelper.GetEmoteAsync(this, Discord, id, options); | ||||
| /// <inheritdoc /> | /// <inheritdoc /> | ||||
| @@ -1008,6 +1008,9 @@ namespace Discord.WebSocket | |||||
| //Emotes | //Emotes | ||||
| /// <inheritdoc /> | /// <inheritdoc /> | ||||
| public Task<IReadOnlyCollection<GuildEmote>> GetEmotesAsync(RequestOptions options = null) | |||||
| => GuildHelper.GetEmotesAsync(this, Discord, options); | |||||
| /// <inheritdoc /> | |||||
| public Task<GuildEmote> GetEmoteAsync(ulong id, RequestOptions options = null) | public Task<GuildEmote> GetEmoteAsync(ulong id, RequestOptions options = null) | ||||
| => GuildHelper.GetEmoteAsync(this, Discord, id, options); | => GuildHelper.GetEmoteAsync(this, Discord, id, options); | ||||
| /// <inheritdoc /> | /// <inheritdoc /> | ||||