Skip to content

Commit

Permalink
Fix deassign command
Browse files Browse the repository at this point in the history
  • Loading branch information
SunburntRock89 committed May 21, 2023
1 parent db8cf73 commit c1267ab
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions src/commands/support/deassign.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,27 @@
import { Numbers } from "@prisma/client";
import Command from "../../internals/commandProcessor";
import { parseNumber } from "../../internals/utils";

export default class Deassign extends Command {
async run(): Promise<void> {
this.interaction.deferReply();

const numberToDeassign = parseNumber(this.interaction.options.getString("number", true));
const numberToDeassign = parseNumber(this.interaction.options.getString("number_or_channel", true));

const number = await this.db.numbers.findUnique({
where: {
number: numberToDeassign,
},
});
let number: Numbers | null;
if (numberToDeassign.length > 11) {
number = await this.db.numbers.findUnique({
where: {
channelID: numberToDeassign,
},
});
} else {
number = await this.db.numbers.findUnique({
where: {
number: numberToDeassign,
},
});
}

if (!number) {
this.interaction.editReply({
Expand Down

0 comments on commit c1267ab

Please sign in to comment.