Fix: Remove optional channel option from twitch add
All checks were successful
Auto Build and Push Docker Image / build (push) Successful in 6s

Discord does not support optional channel options in subcommands.
Streamers are now monitored in the channel where the command is executed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-23 09:56:58 +01:00
parent 1dcd1cad98
commit 0435056271

View File

@@ -1,4 +1,4 @@
import { SlashCommandBuilder, PermissionFlagsBits, EmbedBuilder, MessageFlags, ChannelType } from 'discord.js'; import { SlashCommandBuilder, PermissionFlagsBits, EmbedBuilder, MessageFlags } from 'discord.js';
import { Command } from '../../structures/Command.js'; import { Command } from '../../structures/Command.js';
import { TwitchManager } from '../../structures/TwitchManager.js'; import { TwitchManager } from '../../structures/TwitchManager.js';
@@ -18,10 +18,6 @@ const command: Command = {
subcommand subcommand
.setName('add') .setName('add')
.setDescription('Kanal überwachen (Admin).') .setDescription('Kanal überwachen (Admin).')
.addChannelOption(option =>
option.setName('channel')
.setDescription('Discord-Kanal für Benachrichtigungen (Standard: aktueller Kanal)')
.setRequired(false))
.addStringOption(option => .addStringOption(option =>
option.setName('streamers') option.setName('streamers')
.setDescription('Twitch-Kanäle (kommagetrennt, z.B. shroud, xQc, ninja)') .setDescription('Twitch-Kanäle (kommagetrennt, z.B. shroud, xQc, ninja)')
@@ -63,7 +59,7 @@ const command: Command = {
.setDescription('Überwache Twitch-Streams und bekomme Benachrichtigungen.') .setDescription('Überwache Twitch-Streams und bekomme Benachrichtigungen.')
.addFields( .addFields(
{ name: '`/twitch online <kanal>`', value: 'Prüft, ob ein Kanal gerade online ist.', inline: false }, { name: '`/twitch online <kanal>`', value: 'Prüft, ob ein Kanal gerade online ist.', inline: false },
{ name: '`/twitch add [kanal] streamer1, streamer2, ...`', value: 'Überwacht mehrere Twitch-Kanäle (Mod).\nOptional: Discord-Kanal oder aktueller Kanal.', inline: false }, { name: '`/twitch add streamer1, streamer2, ...`', value: 'Überwacht Twitch-Kanäle in diesem Kanal (Mod).', inline: false },
{ name: '`/twitch remove streamer1, streamer2, ...`', value: 'Entfernt Twitch-Kanäle (Mod).', inline: false }, { name: '`/twitch remove streamer1, streamer2, ...`', value: 'Entfernt Twitch-Kanäle (Mod).', inline: false },
{ name: '`/twitch list`', value: 'Zeigt überwachte Kanäle in diesem Kanal.', inline: false }, { name: '`/twitch list`', value: 'Zeigt überwachte Kanäle in diesem Kanal.', inline: false },
{ name: '`/twitch listall`', value: 'Zeigt alle überwachten Kanäle des Servers (Mod).', inline: false }, { name: '`/twitch listall`', value: 'Zeigt alle überwachten Kanäle des Servers (Mod).', inline: false },
@@ -174,7 +170,7 @@ const command: Command = {
const discordChannel = interaction.options.getChannel('channel'); const discordChannel = interaction.options.getChannel('channel');
const streamersInput = interaction.options.getString('streamers')!; const streamersInput = interaction.options.getString('streamers')!;
const message = interaction.options.getString('message'); const message = interaction.options.getString('message');
const discordChannelId = discordChannel?.id || interaction.channelId; const discordChannelId = interaction.channelId;
// Parse comma-separated streamers // Parse comma-separated streamers
const streamers = streamersInput const streamers = streamersInput