[ifcbrk] feature: suppress messages

yeah man I support the first amendment
This commit is contained in:
Christopher Felegy
2019-06-21 17:17:54 -04:00
parent 1e8aa080ab
commit cd288923c3
9 changed files with 65 additions and 2 deletions

View File

@@ -16,7 +16,7 @@ namespace Discord.WebSocket
public class SocketUserMessage : SocketMessage, IUserMessage
{
private readonly List<SocketReaction> _reactions = new List<SocketReaction>();
private bool _isMentioningEveryone, _isTTS, _isPinned;
private bool _isMentioningEveryone, _isTTS, _isPinned, _isSuppressed;
private long? _editedTimestampTicks;
private ImmutableArray<Attachment> _attachments = ImmutableArray.Create<Attachment>();
private ImmutableArray<Embed> _embeds = ImmutableArray.Create<Embed>();
@@ -27,6 +27,8 @@ namespace Discord.WebSocket
/// <inheritdoc />
public override bool IsPinned => _isPinned;
/// <inheritdoc />
public override bool IsSuppressed => _isSuppressed;
/// <inheritdoc />
public override DateTimeOffset? EditedTimestamp => DateTimeUtils.FromTicks(_editedTimestampTicks);
/// <inheritdoc />
public override IReadOnlyCollection<Attachment> Attachments => _attachments;
@@ -66,6 +68,10 @@ namespace Discord.WebSocket
_editedTimestampTicks = model.EditedTimestamp.Value?.UtcTicks;
if (model.MentionEveryone.IsSpecified)
_isMentioningEveryone = model.MentionEveryone.Value;
if (model.Flags.IsSpecified)
{
_isSuppressed = model.Flags.Value.HasFlag(API.MessageFlags.Suppressed);
}
if (model.Attachments.IsSpecified)
{
@@ -159,6 +165,9 @@ namespace Discord.WebSocket
/// <inheritdoc />
public Task UnpinAsync(RequestOptions options = null)
=> MessageHelper.UnpinAsync(this, Discord, options);
/// <inheritdoc />
public Task ModifySuppressionAsync(bool suppressEmbeds, RequestOptions options = null)
=> MessageHelper.SuppressEmbedsAsync(this, Discord, suppressEmbeds, options);
public string Resolve(int startIndex, TagHandling userHandling = TagHandling.Name, TagHandling channelHandling = TagHandling.Name,
TagHandling roleHandling = TagHandling.Name, TagHandling everyoneHandling = TagHandling.Ignore, TagHandling emojiHandling = TagHandling.Name)