Skip to content

Commit

Permalink
commands(liveStreams): filter invalid channel names
Browse files Browse the repository at this point in the history
Signed-off-by: TRACTION <19631364+iamtraction@users.noreply.github.com>
  • Loading branch information
iamtraction committed Nov 19, 2023
1 parent 4fdcf0b commit 79dbe05
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/commands/config/liveStreams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { Command } from "@bastion/tesseract";
import GuildModel from "../../models/Guild.js";
import { isPublicBastion } from "../../utils/constants.js";
import { checkFeature, Feature, getPremiumTier } from "../../utils/premium.js";
import { TWITCH_CHANNEL } from "../../utils/regex.js";

class LiveStreamsCommand extends Command {
constructor() {
Expand Down Expand Up @@ -47,7 +48,7 @@ class LiveStreamsCommand extends Command {
if (twitchChannel || channel || message) {
// update followed channels
if (twitchChannel) {
guildDocument.twitchNotificationUsers = guildDocument.twitchNotificationUsers?.includes(twitchChannel) ? guildDocument.twitchNotificationUsers.filter(u => u !== twitchChannel) : guildDocument.twitchNotificationUsers?.concat(twitchChannel);
guildDocument.twitchNotificationUsers = guildDocument.twitchNotificationUsers?.includes(twitchChannel) ? guildDocument.twitchNotificationUsers.filter(u => TWITCH_CHANNEL.test(u)).filter(u => u !== twitchChannel) : guildDocument.twitchNotificationUsers?.concat(twitchChannel);

// check for limits
if (isPublicBastion(interaction.client.user.id)) {
Expand Down

0 comments on commit 79dbe05

Please sign in to comment.