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

Document rule for attachment names for proper functioning in embeds #2959

Open
wants to merge 2 commits into
base: current
Choose a base branch
from

Conversation

ivinjabraham
Copy link
Contributor

Address #2635 by documenting Discord's rules for attachment URLS in the attachment and image methods of CreateEmbed.

It is worth noting that these rules apply to all attachment URLs. I chose to document only in CreateEmbed as this is, as far as I know, the only case where unexpected behaviour occurs when the name contains invalid characters. In other cases, Discord handles it by stripping or replacing the invalid characters with underscores and no error is thrown.

@github-actions github-actions bot added the builder Related to the `builder` module. label Aug 27, 2024
Comment on lines 105 to 108
/// The URL must be ASCII alphanumeric characters ('a-z', 'A-Z', '0-9').
/// Underscores ('\_'), dashes ('-') and dots ('.') are allowed but they must not
/// appear as the first character. Otherwise, the attachment will be sent separately from the
/// Embed.
Copy link
Member

Choose a reason for hiding this comment

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

This is a bit of a misfit with the line above saying it only supports HTTP(S), either adjust that line or adjust what you have written.

@GnomedDev
Copy link
Member

I feel like this would be better served by a PR to the discord developer docs, then simply linking there, as we cannot guarantee the rules keep up to date.

@ivinjabraham
Copy link
Contributor Author

ivinjabraham commented Aug 29, 2024

Discord does mention the rules for naming here. Though you have to dig a little to see it. Should I just link this?

As for the changes requested, I was awaiting verdict on #2776 before removing the misleading HTTP(S) comment. Will remove them now.

@GnomedDev
Copy link
Member

Yeah, please do link to it, if there is Discord documentation on something we are moving to just link to that to prevent our docs rotting so much.

@ivinjabraham
Copy link
Contributor Author

Updated as requested

src/builder/create_embed.rs Outdated Show resolved Hide resolved
src/builder/create_embed.rs Show resolved Hide resolved
@ivinjabraham
Copy link
Contributor Author

Rebased to make sure the edits are in the right commits.

@ivinjabraham
Copy link
Contributor Author

On merging, please don't forget to close #2635 as well as #2776.

@GnomedDev
Copy link
Member

If you want to make that automatic, put "closes/fixes #xxx" in the PR description. See the docs for that here.

@ivinjabraham
Copy link
Contributor Author

If you want to make that automatic, put "closes/fixes #xxx" in the PR description. See the docs for that here.

Thanks for the tip!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
builder Related to the `builder` module.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants