From 7538a2ebb8bc111bd974eab7d037e8a4a558a10a Mon Sep 17 00:00:00 2001 From: DrunkenToast Date: Sat, 20 Nov 2021 21:34:56 +0100 Subject: [PATCH] fix: loading message isn't required --- src/commands/remove.ts | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/src/commands/remove.ts b/src/commands/remove.ts index e098484..bdca944 100644 --- a/src/commands/remove.ts +++ b/src/commands/remove.ts @@ -1,9 +1,8 @@ -import {Message, TextChannel} from 'discord.js'; +import {Message} from 'discord.js'; import {inject, injectable} from 'inversify'; import {TYPES} from '../types.js'; import PlayerManager from '../managers/player.js'; import Command from '.'; -import LoadingMessage from '../utils/loading-message.js'; import errorMsg from '../utils/error-msg.js'; @injectable() @@ -24,11 +23,8 @@ export default class implements Command { public async execute(msg: Message, args: string []): Promise { const player = this.playerManager.get(msg.guild!.id); - const res = new LoadingMessage(msg.channel as TextChannel); - await res.start(); - if (args.length === 0) { - await res.stop('atleast give me a clue for which song you want to remove'); + await msg.channel.send('atleast give me a clue for which song you want to remove'); return; } @@ -36,7 +32,7 @@ export default class implements Command { const match = reg.exec(args[0]); if (match === null) { - await res.stop(errorMsg('incorrect format, just an index or start-end format')); + await msg.channel.send(errorMsg('incorrect format, just an index or start-end format')); return; } @@ -44,19 +40,19 @@ export default class implements Command { const range = [parseInt(match[1], 10), parseInt(match[2], 10)]; if (range[0] < 1) { - await res.stop(errorMsg('you start counting with 1')); + await msg.channel.send(errorMsg('you start counting with 1')); return; } if (range[1] > player.queueSize()) { - await res.stop(errorMsg('queue isn\'t THAT big')); + await msg.channel.send(errorMsg('queue isn\'t THAT big')); return; } if (range[0] < range[1]) { player.removeFromQueue(range[0], range[1] - range[0] + 1); } else { - await res.stop(errorMsg('range is backwards, just like you')); + await msg.channel.send(errorMsg('range is backwards, just like you')); return; } @@ -65,18 +61,18 @@ export default class implements Command { const index = parseInt(match[3], 10); if (index < 1) { - await res.stop(errorMsg('it\'s got be bigger than 0, chief')); + await msg.channel.send(errorMsg('it\'s got be bigger than 0, chief')); return; } if (index > player.queueSize()) { - await res.stop(errorMsg('queue isn\'t THAT big')); + await msg.channel.send(errorMsg('queue isn\'t THAT big')); return; } player.removeFromQueue(index, 1); } - await res.stop('to the trash it goes :wastebasket:'); + await msg.channel.send('to the trash it goes :wastebasket:'); } }