feature: Add support for spoiler formatting & attachments (#1255)

Resolves #1216.

* Add support for spoiler formatting

* Implement support for sending message attachments that are spoilers

* use consistent naming

* update docstring for new isSpoiler param

* move extension method to be under core project, make spoiler prefix a const

* typo fix

* update missing xmldocs

* move SpoilerPrefix const outside of interface

* Add isSpoiler support to webhook client

adds the isSpoiler field to uploading files with a webhook, which will only
insert "SPOILER_" to the start of the filename. This does not include other
fields in the payload, as this is not in the documentation, and was not observed
like in the regular client
This commit is contained in:
Chris Johnston
2019-05-17 16:28:40 -07:00
committed by Christopher F
parent 76f82d687b
commit f3b20b2b6d
16 changed files with 104 additions and 71 deletions

View File

@@ -93,13 +93,13 @@ namespace Discord.Webhook
/// <summary> Sends a message to the channel for this webhook with an attachment. </summary>
/// <returns> Returns the ID of the created message. </returns>
public Task<ulong> SendFileAsync(string filePath, string text, bool isTTS = false,
IEnumerable<Embed> embeds = null, string username = null, string avatarUrl = null, RequestOptions options = null)
=> WebhookClientHelper.SendFileAsync(this, filePath, text, isTTS, embeds, username, avatarUrl, options);
IEnumerable<Embed> embeds = null, string username = null, string avatarUrl = null, RequestOptions options = null, bool isSpoiler = false)
=> WebhookClientHelper.SendFileAsync(this, filePath, text, isTTS, embeds, username, avatarUrl, options, isSpoiler);
/// <summary> Sends a message to the channel for this webhook with an attachment. </summary>
/// <returns> Returns the ID of the created message. </returns>
public Task<ulong> SendFileAsync(Stream stream, string filename, string text, bool isTTS = false,
IEnumerable<Embed> embeds = null, string username = null, string avatarUrl = null, RequestOptions options = null)
=> WebhookClientHelper.SendFileAsync(this, stream, filename, text, isTTS, embeds, username, avatarUrl, options);
IEnumerable<Embed> embeds = null, string username = null, string avatarUrl = null, RequestOptions options = null, bool isSpoiler = false)
=> WebhookClientHelper.SendFileAsync(this, stream, filename, text, isTTS, embeds, username, avatarUrl, options, isSpoiler);
/// <summary> Modifies the properties of this webhook. </summary>
public Task ModifyWebhookAsync(Action<WebhookProperties> func, RequestOptions options = null)