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

Validate Discord channel names #39

Merged
merged 8 commits into from
Feb 27, 2023
Merged

Validate Discord channel names #39

merged 8 commits into from
Feb 27, 2023

Conversation

richfromm
Copy link
Owner

The following criteria must be met:

  • Names must contain only alphanumeric, dash (-), and/or underscore (_) characters
  • Length must be between 1 and 100 chars (inclusive)
  • Multiple dashes in a row (e.g. --) are not permitted

The actual reality of Discord channel creation is a bit more complex. Empirically, there
are numerous (undocumented?) cases where an input channel name does not fail to create
a channel, but the channel created does not have precisely the same name as the input. For
example:

  • Multiple dashes in a row are converted into a single dash
  • Space and tilde are converted to dash
  • Tab and newline are removed
  • All other symbols are removed

For our purposes, this is too complex to deal with, and we will fail to validate any input
that does not result in creating a channel with the same name as the input.

#24

The following criteria must be met:
* Names must contain only alphanumeric, dash (-), and/or underscore (_) characters
* Length must be between 1 and 100 chars (inclusive)
* Multiple dashes in a row (e.g. --) are not permitted

The actual reality of Discord channel creation is a bit more complex. Empirically, there
are numerous (undocumented?) cases where an input channel name does **not** fail to create
a channel, but the channel created does not have precisely the same name as the input. For
example:
* Multiple dashes in a row are converted into a single dash
* Space and tilde are converted to dash
* Tab and newline are removed
* All other symbols are removed

For our purposes, this is too complex to deal with, and we will fail to validate any input
that does not result in creating a channel with the same name as the input.

#24
Which will cause it to be automatically run by the GitHub Actions
No need to modify .github/workflows/check.yaml

No pytest config yet, just note possible future options
@richfromm richfromm linked an issue Feb 21, 2023 that may be closed by this pull request
"123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789", # noqa: E501
"1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", # noqa: E501
])
def test_valid_channel_name(self, channel_name):
Copy link
Owner Author

Choose a reason for hiding this comment

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

I hope to add more automated tests later (not right now), this seemed a good place to start.

@richfromm richfromm merged commit c807e99 into master Feb 27, 2023
@richfromm richfromm deleted the channel-validate branch February 27, 2023 20:45
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.

Parsing error of channel names with multiple dashes
2 participants