Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #1216, Add support for spoiler formatting & attachments #1255

Merged
merged 9 commits into from
May 17, 2019

Conversation

Chris-Johnston
Copy link
Collaborator

@Chris-Johnston Chris-Johnston commented Jan 31, 2019

Fix #1216

Implements support for formatting text as spoilers, and spoiler attachments.

  • Adds a method to convert text to spoiler text in the Format class.
  • Adds | to the list of characters to escape, since this is used for formatting spoilers.
  • Adds isSpoiler optional parameter to SendFileAsync.
    • Adds a field to UploadFileParams. When this is set to true, the file name will be prefixed with the text "SPOILER_". Will also send the hasSpoiler value in the upload request body.
    • From my observations, the client only cares that attachments begin with SPOILER_, and not that the hasSpoiler property is supplied.
  • Adds an extension method for IAttachment which checks if an attachment is a spoiler. Spoilers attachments can be of any type, not just images.

@Chris-Johnston Chris-Johnston changed the title Fix #1216, Add support for spoiler formatting Fix #1216, Add support for spoiler formatting & attachments Jan 31, 2019
/// <summary>
/// The prefix applied to files to indicate that it is a spoiler.
/// </summary>
public const string SpoilerPrefix = "SPOILER_";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👀? We're not building with preview compiler versions, are we?
How does this not produce a CI failure?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, this was just my mistake. I didn't build before committing. Also, it seems that CI hasn't been working since we moved to the org.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, we need to get it moved over from Volt's personal repo. cc @RogueException

@AntiTcb
Copy link
Collaborator

AntiTcb commented Feb 4, 2019

Should also be added to DiscordWebhookClient.SendFileAsync if those support spoiler attachments as well.

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
@foxbot foxbot merged commit f3b20b2 into discord-net:dev May 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for spoilers
5 participants