Skip to content

Commit

Permalink
🐛 Fix deletion of slash command options
Browse files Browse the repository at this point in the history
  • Loading branch information
Androz2091 committed Mar 21, 2021
1 parent 0386834 commit eb15b97
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/components/SlashCommandOption.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit eb15b97

Please # to comment.