diff options
author | Madeline <46743919+MaddyUnderStars@users.noreply.github.com> | 2022-01-15 18:00:54 +1100 |
---|---|---|
committer | Erkin Alp Güney <erkinalp9035@gmail.com> | 2022-01-23 23:29:14 +0300 |
commit | b08bb3007579bf05e575bf59c5e3dc559fc9e143 (patch) | |
tree | 121237cedb023563d92c8df2063515b98c29f880 | |
parent | Update Channel.ts (diff) | |
download | server-b08bb3007579bf05e575bf59c5e3dc559fc9e143.tar.xz |
Apply suggestions from code review
Co-authored-by: Erkin Alp Güney <erkinalp9035@gmail.com>
-rw-r--r-- | util/src/entities/Channel.ts | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/util/src/entities/Channel.ts b/util/src/entities/Channel.ts index f0bbfe96..aa1b823e 100644 --- a/util/src/entities/Channel.ts +++ b/util/src/entities/Channel.ts @@ -161,7 +161,8 @@ export class Channel extends BaseClass { if (!opts?.skipNameChecks) { const guild = await Guild.findOneOrFail({ id: channel.guild_id }); - if (!guild.features.includes("ILLEGAL_CHANNEL_NAMES") && channel.name) { + if (!guild.features.includes("ALLOW_INVALID_CHANNEL_NAMES") && channel.name) { + for (var character of InvisibleCharacters) channel.name = channel.name.split(character).join("-"); @@ -169,7 +170,8 @@ export class Channel extends BaseClass { channel.name = channel.name.split("-").filter(Boolean).join("-"); //trim '-' character } - if (!guild.features.includes("NULL_CHANNEL_NAMES")) { + if (!guild.features.includes("ALLOW_UNNAMED_CHANNELS")) { + if (channel.name) channel.name = channel.name.trim(); if (!channel.name) throw new HTTPError("Channel name cannot be empty."); |