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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user