Skip to content

Commit

Permalink
Actually delete the number
Browse files Browse the repository at this point in the history
  • Loading branch information
SunburntRock89 committed May 21, 2023
1 parent 09f776a commit e4dc66a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/commands/support/deassign.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,16 @@ export default class Deassign extends Command {
return;
}

this.client.deleteNumber(number.number);
try {
const res = await this.client.deleteNumber(number.number);

if (res === false) throw new Error();
} catch {
this.interaction.editReply({
embeds: [this.client.errorEmbed("Couldn't delete that number.")],
});
return;
}

this.interaction.editReply({
embeds: [{
Expand Down
6 changes: 6 additions & 0 deletions src/internals/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,12 @@ class DTelClient extends Client<true> {
}


await db.numbers.delete({
where: {
number: numberDoc.number,
},
});

let ownerDMChannel: DMChannel | null | undefined;

if (numberDoc.guildID) {
Expand Down

0 comments on commit e4dc66a

Please sign in to comment.