diff --git a/src/components/SlashCommandOption.vue b/src/components/SlashCommandOption.vue index 6b9aced..2243777 100644 --- a/src/components/SlashCommandOption.vue +++ b/src/components/SlashCommandOption.vue @@ -77,16 +77,17 @@ export default { this.deleteModalLoading = true; const newCommand = cloneObject(this.command); const newSubCommand = this.subcommand ? cloneObject(this.subcommand) : null; - if (this.subcommand) { + if (!newSubCommand.options) newSubCommand.options = []; + newSubCommand.options = newSubCommand.options.filter((opt) => opt.name !== this.option.name); + if (this.subgroup) { const newGroup = cloneObject(this.subgroup); newCommand.options = newCommand.options.filter((opt) => opt.name !== this.subgroup.name); newGroup.options = newGroup.options.filter((opt) => opt.name !== this.subcommand.name); - if (!newSubCommand.options) newSubCommand.options = []; - newSubCommand.options = newSubCommand.options.filter((opt) => opt.name !== this.option.name); newGroup.options.push(newSubCommand); newCommand.options.push(newGroup); } else { - newCommand.options = newCommand.options.filter((opt) => opt.name !== this.option.name); + newCommand.options = newCommand.options.filter((opt) => opt.name !== this.subcommand.name); + newCommand.options.push(newSubCommand); } updateCommand(this.$store.state.clientID, this.$store.state.token.value, this.$store.state.selectedGuildID, newCommand).then(() => { this.$store.dispatch('updateCommand', newCommand);