-
-
Notifications
You must be signed in to change notification settings - Fork 3
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
Parsing error of channel names with multiple dashes #24
Comments
Apologies for taking so long to respond to this. I didn't see any of these open issues until yesterday. See #22 (comment) I am able to locally reproduce the issue, see attached log. |
I can't find anything documenting it (certainly not in the This is even outside of the API, doing it manually within the GUI, I can't type in a second dash in the popup for entering the name for a new channel. It just doesn't recognize that I've typed that character. But the API behavior is a little weird. Rather than raise an error if you pass an invalid name, it instead just converts multiple dashes into a single dash, creates the new channel with that modified name, then returns that name to you as the new channel. And that causes an assertion of mine to fail, since it doesn't match what's expected: slack2discord/slack2discord/client.py Line 159 in 2617f7e
I suppose we could just go along with this, and automatically do the same, but I don't like the idea of doing that. What if you have both It also appears that empirically Discord doesn't allow spaces in channels, so there's the question as to whether we should include that in the channel name validation or not. Their treatment of spaces is a little different, if you type one in the GUI it actually translates that to a dash instead. (I haven't verified if the same thing happens with the API, but I'd guess so.) And then a second space just doesn't work, just like a second dash doesn't work. However, it appears that Slack also doesn't allow for spaces, so maybe this isn't worth worrying about in practice? I'm undecided, but I might just toss it in anyway, since if I'm going to add some channel name validation and an error msg to inform the user about how to deal with it, it's pretty trivial to add one more criteria to the validation check. |
Allegedly there is no limit on channel name length in Discord (unlike Slack), see https://discord.com/moderation/208-channel-categories-and-names#title-2 So I think I will limit validation to checking for repeated dashes, as well as any spaces (or perhaps any whitespace). UPDATE: In the Discord GUI, trying every non-alphanumeric character on my (US) keyboard, the only non-alphanumeric characters accepted are dash ( |
I did some tests regarding channel creation. It would be nice if this were just documented. Here's what I found regarding channel names:
An additional observation is that if you try to create a channel with a name that already exists, that succeeds, a new channel is created with a dupe name. I don't want to put too much energy into dealing with this, b/c IMHO it's a really stupid thing to do. Regardless, right now in Anyway, given all of the various undocumented restrictions, I think my validation criteria will be:
UPDATE: I hadn't explicitly tested for this before, but double underscore is fine, as is underscore followed by dash, and dash followed by underscore. It's only multiple dashes in a row that are a problem (even dash underscore dash is fine). |
See my current plan here |
Somewhat change of plan. I still like the idea of querying Discord state early, and (by default) prompting the user for confirmation regarding the category/channel situation, as outlined above. And I will try to get to it in the not too distant future. But, for reasons discussed earlier, it's non-trivial to implement, given the async nature of the Discord API. So for the short term resolution of this issue, I think it's fine to validate all of the supplied Discord channel names (and fail fast if any do not), early in the process, without querying Discord state to see whether or not the channels exist. Similar short term change of plan at #23 (comment) |
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
One of my Slack channels was named something similar to
string1---string2
. This got parsed asstring1-string2
when creating the channel, but asstring1---string2
when trying to post messages to the channel (which then failed because a channel with that name hadn't yet been created). This should be fixed so it is consistent.The text was updated successfully, but these errors were encountered: