@@ -270,7 +270,14 @@ namespace Discord | |||||
/// A task that represents the asynchronous removal operation. | /// A task that represents the asynchronous removal operation. | ||||
/// </returns> | /// </returns> | ||||
Task RemoveAllReactionsForEmoteAsync(IEmote emote, RequestOptions options = null); | Task RemoveAllReactionsForEmoteAsync(IEmote emote, RequestOptions options = null); | ||||
/// <summary> | |||||
/// Suppresses embeds for a specified message. | |||||
/// </summary> | |||||
/// <param name="options">The options to be used when sending the request.</param> | |||||
/// <returns> | |||||
/// A task that represents the asynchronous operation to set the suppress embeds flags on a message. | |||||
/// </returns> | |||||
Task SuppressEmbeds(RequestOptions options = null); | |||||
/// <summary> | /// <summary> | ||||
/// Gets all users that reacted to a message with a given emote. | /// Gets all users that reacted to a message with a given emote. | ||||
/// </summary> | /// </summary> | ||||
@@ -931,6 +931,19 @@ namespace Discord.API | |||||
#endregion | #endregion | ||||
#region Stickers, Reactions, Crosspost, and Acks | #region Stickers, Reactions, Crosspost, and Acks | ||||
public async Task SuppressEmbeds(ulong channelId, ulong messageId, RequestOptions options = null) | |||||
{ | |||||
Preconditions.NotEqual(channelId, 0, nameof(channelId)); | |||||
Preconditions.NotEqual(messageId, 0, nameof(messageId)); | |||||
Rest.ModifyMessageParams args = new Rest.ModifyMessageParams(); | |||||
args.Flags = MessageFlags.SuppressEmbeds; | |||||
options = RequestOptions.CreateOrClone(options); | |||||
var ids = new BucketIds(channelId: channelId); | |||||
await SendJsonAsync<Message>("PATCH", () => $"channels/{channelId}/messages/{messageId}", args, ids, clientBucket: ClientBucketType.SendEdit, options: options).ConfigureAwait(false); | |||||
} | |||||
public async Task<Sticker> GetStickerAsync(ulong id, RequestOptions options = null) | public async Task<Sticker> GetStickerAsync(ulong id, RequestOptions options = null) | ||||
{ | { | ||||
Preconditions.NotEqual(id, 0, nameof(id)); | Preconditions.NotEqual(id, 0, nameof(id)); | ||||
@@ -209,7 +209,9 @@ namespace Discord.Rest | |||||
=> MessageHelper.RemoveAllReactionsAsync(channelId, messageId, this, options); | => MessageHelper.RemoveAllReactionsAsync(channelId, messageId, this, options); | ||||
public Task RemoveAllReactionsForEmoteAsync(ulong channelId, ulong messageId, IEmote emote, RequestOptions options = null) | public Task RemoveAllReactionsForEmoteAsync(ulong channelId, ulong messageId, IEmote emote, RequestOptions options = null) | ||||
=> MessageHelper.RemoveAllReactionsForEmoteAsync(channelId, messageId, emote, this, options); | => MessageHelper.RemoveAllReactionsForEmoteAsync(channelId, messageId, emote, this, options); | ||||
#endregion | |||||
public Task SuppressEmbeds(ulong channelId, ulong messageId, RequestOptions options = null) | |||||
=> MessageHelper.SuppressEmbeds(channelId, messageId, this, options); | |||||
#endregion | |||||
#region IDiscordClient | #region IDiscordClient | ||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
@@ -160,6 +160,15 @@ namespace Discord.Rest | |||||
await client.ApiClient.RemoveAllReactionsForEmoteAsync(msg.Channel.Id, msg.Id, emote is Emote e ? $"{e.Name}:{e.Id}" : UrlEncode(emote.Name), options).ConfigureAwait(false); | await client.ApiClient.RemoveAllReactionsForEmoteAsync(msg.Channel.Id, msg.Id, emote is Emote e ? $"{e.Name}:{e.Id}" : UrlEncode(emote.Name), options).ConfigureAwait(false); | ||||
} | } | ||||
public static async Task SuppressEmbeds(IMessage msg, BaseDiscordClient client, RequestOptions options) | |||||
{ | |||||
await client.ApiClient.SuppressEmbeds(msg.Channel.Id, msg.Id, options).ConfigureAwait(false); | |||||
} | |||||
public static async Task SuppressEmbeds(ulong channelId, ulong messageId, BaseDiscordClient client, RequestOptions options) | |||||
{ | |||||
await client.ApiClient.SuppressEmbeds(channelId, messageId, options).ConfigureAwait(false); | |||||
} | |||||
public static IAsyncEnumerable<IReadOnlyCollection<IUser>> GetReactionUsersAsync(IMessage msg, IEmote emote, | public static IAsyncEnumerable<IReadOnlyCollection<IUser>> GetReactionUsersAsync(IMessage msg, IEmote emote, | ||||
int? limit, BaseDiscordClient client, RequestOptions options) | int? limit, BaseDiscordClient client, RequestOptions options) | ||||
{ | { | ||||
@@ -295,6 +295,9 @@ namespace Discord.Rest | |||||
public Task RemoveAllReactionsForEmoteAsync(IEmote emote, RequestOptions options = null) | public Task RemoveAllReactionsForEmoteAsync(IEmote emote, RequestOptions options = null) | ||||
=> MessageHelper.RemoveAllReactionsForEmoteAsync(this, emote, Discord, options); | => MessageHelper.RemoveAllReactionsForEmoteAsync(this, emote, Discord, options); | ||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public Task SuppressEmbeds(RequestOptions options = null) | |||||
=> MessageHelper.SuppressEmbeds(this, Discord, options); | |||||
/// <inheritdoc /> | |||||
public IAsyncEnumerable<IReadOnlyCollection<IUser>> GetReactionUsersAsync(IEmote emote, int limit, RequestOptions options = null) | public IAsyncEnumerable<IReadOnlyCollection<IUser>> GetReactionUsersAsync(IEmote emote, int limit, RequestOptions options = null) | ||||
=> MessageHelper.GetReactionUsersAsync(this, emote, limit, Discord, options); | => MessageHelper.GetReactionUsersAsync(this, emote, limit, Discord, options); | ||||
} | } | ||||
@@ -343,6 +343,9 @@ namespace Discord.WebSocket | |||||
public Task RemoveAllReactionsForEmoteAsync(IEmote emote, RequestOptions options = null) | public Task RemoveAllReactionsForEmoteAsync(IEmote emote, RequestOptions options = null) | ||||
=> MessageHelper.RemoveAllReactionsForEmoteAsync(this, emote, Discord, options); | => MessageHelper.RemoveAllReactionsForEmoteAsync(this, emote, Discord, options); | ||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public Task SuppressEmbeds(RequestOptions options = null) | |||||
=> MessageHelper.SuppressEmbeds(this, Discord, options); | |||||
/// <inheritdoc /> | |||||
public IAsyncEnumerable<IReadOnlyCollection<IUser>> GetReactionUsersAsync(IEmote emote, int limit, RequestOptions options = null) | public IAsyncEnumerable<IReadOnlyCollection<IUser>> GetReactionUsersAsync(IEmote emote, int limit, RequestOptions options = null) | ||||
=> MessageHelper.GetReactionUsersAsync(this, emote, limit, Discord, options); | => MessageHelper.GetReactionUsersAsync(this, emote, limit, Discord, options); | ||||
#endregion | #endregion | ||||