Refactor tag editing command to improve option handling and embed structure

- Simplified the retrieval of command options for editing tags, enhancing readability and maintainability.
- Updated embed handling to use an object structure instead of null, ensuring consistency in the updateTag function.
- Improved overall clarity by using descriptive variable names for command options.
This commit is contained in:
smueller
2026-07-22 13:09:06 +02:00
parent 8ec9b94879
commit 1ceb8c3574
3 changed files with 31 additions and 23 deletions

View File

@@ -1,4 +1,4 @@
import { PermissionFlagsBits } from 'discord.js';
import { ChannelType, PermissionFlagsBits } from 'discord.js';
import {
SelfRoleBehaviorSchema,
SelfRoleModeSchema,
@@ -71,8 +71,7 @@ const selfrolesCommand: SlashCommand = {
);
const mode = SelfRoleModeSchema.parse(interaction.options.getString('mode', true));
const channel = interaction.options.getChannel('channel', true);
if (!channel.isTextBased() || channel.isDMBased()) {
if (channel.type !== ChannelType.GuildText && channel.type !== ChannelType.GuildAnnouncement) {
await interaction.reply({
content: t(locale, 'selfroles.error.invalid_channel'),
ephemeral: true