#Channel naming

6 messages · Page 1 of 1 (latest)

gleaming elm
#

Hello!
I'm working on a ticket system that creates a channel, and uses user.tag as part of the channel name.
Is there a chance that a user has such a fancy name that it it won't be usable in a channel name?
Or are the rules for naming channels and users the same / user.tag already returns the user's tag in a "safe" format?

viral mortar
#

• What's your exact discord.js npm list discord.js and node node -v version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.

tough jewel
#

The tag can have much different characters than channels allow (remember text channels don't even allow capital letters)

Hence, most ticket bots just use the id instead

gleaming elm
#

What I am doing now is:

  • I create the channel name like this:
    const ticketchannelname = `${interaction.user.tag}--${new Date(Date.now()).toLocaleString('hu-HU')}`;
  • Then use this constant as the name parameter for guild.channels.create

Worked fine so far with my not so fancy name, didn't care about the capital letter, created the channel in all lowercases, even was able to turn the date and timestamp into the "channel name format"

eg: farleena-dani8626-2022-12-31-182742

I was just curious if some random dude with superduper extra fancy special characters in his username could make make this command error out

#

Well, I could use the user id, but that looks dumb as a channel name and is not so easy to read 😄

ebon frigate
#

Discord will strip out any invalid characters, so you might end up with a channel name only consisting of their denominator and the datetime… that’s about it