[Feature] Polls (#2902)

no breakings hopefully
This commit is contained in:
Mihail Gribkov
2024-05-11 23:34:12 +03:00
committed by GitHub
parent 5dadcb2e30
commit 476ec068f1
75 changed files with 1372 additions and 424 deletions

View File

@@ -52,6 +52,9 @@ namespace Discord.WebSocket
/// <inheritdoc />
public IMessageInteractionMetadata InteractionMetadata { get; internal set; }
/// <inheritdoc />
public Poll? Poll { get; internal set; }
/// <inheritdoc />
public MessageResolvedData ResolvedData { get; internal set; }
@@ -209,6 +212,9 @@ namespace Discord.WebSocket
if (model.InteractionMetadata.IsSpecified)
InteractionMetadata = model.InteractionMetadata.Value.ToInteractionMetadata();
if (model.Poll.IsSpecified)
Poll = model.Poll.Value.ToEntity();
}
/// <inheritdoc />
@@ -244,6 +250,15 @@ namespace Discord.WebSocket
return MessageHelper.CrosspostAsync(this, Discord, options);
}
/// <inheritdoc />
public Task EndPollAsync(RequestOptions options = null)
=> MessageHelper.EndPollAsync(Channel.Id, Id, Discord, options);
/// <inheritdoc />
public IAsyncEnumerable<IReadOnlyCollection<IUser>> GetPollAnswerVotersAsync(uint answerId, int? limit = null, ulong? afterId = null,
RequestOptions options = null)
=> MessageHelper.GetPollAnswerVotersAsync(Channel.Id, Id, afterId, answerId, limit, Discord, options);
private string DebuggerDisplay => $"{Author}: {Content} ({Id}{(Attachments.Count > 0 ? $", {Attachments.Count} Attachments" : "")})";
internal new SocketUserMessage Clone() => MemberwiseClone() as SocketUserMessage;
}