mirror of
https://github.com/BluemediaDev/muse.git
synced 2025-04-19 21:03:56 +02:00
fix: loading message isn't required
This commit is contained in:
parent
fe233cb98c
commit
7538a2ebb8
1 changed files with 9 additions and 13 deletions
|
@ -1,9 +1,8 @@
|
||||||
import {Message, TextChannel} from 'discord.js';
|
import {Message} from 'discord.js';
|
||||||
import {inject, injectable} from 'inversify';
|
import {inject, injectable} from 'inversify';
|
||||||
import {TYPES} from '../types.js';
|
import {TYPES} from '../types.js';
|
||||||
import PlayerManager from '../managers/player.js';
|
import PlayerManager from '../managers/player.js';
|
||||||
import Command from '.';
|
import Command from '.';
|
||||||
import LoadingMessage from '../utils/loading-message.js';
|
|
||||||
import errorMsg from '../utils/error-msg.js';
|
import errorMsg from '../utils/error-msg.js';
|
||||||
|
|
||||||
@injectable()
|
@injectable()
|
||||||
|
@ -24,11 +23,8 @@ export default class implements Command {
|
||||||
public async execute(msg: Message, args: string []): Promise<void> {
|
public async execute(msg: Message, args: string []): Promise<void> {
|
||||||
const player = this.playerManager.get(msg.guild!.id);
|
const player = this.playerManager.get(msg.guild!.id);
|
||||||
|
|
||||||
const res = new LoadingMessage(msg.channel as TextChannel);
|
|
||||||
await res.start();
|
|
||||||
|
|
||||||
if (args.length === 0) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +32,7 @@ export default class implements Command {
|
||||||
const match = reg.exec(args[0]);
|
const match = reg.exec(args[0]);
|
||||||
|
|
||||||
if (match === null) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,19 +40,19 @@ export default class implements Command {
|
||||||
const range = [parseInt(match[1], 10), parseInt(match[2], 10)];
|
const range = [parseInt(match[1], 10), parseInt(match[2], 10)];
|
||||||
|
|
||||||
if (range[0] < 1) {
|
if (range[0] < 1) {
|
||||||
await res.stop(errorMsg('you start counting with 1'));
|
await msg.channel.send(errorMsg('you start counting with 1'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (range[1] > player.queueSize()) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (range[0] < range[1]) {
|
if (range[0] < range[1]) {
|
||||||
player.removeFromQueue(range[0], range[1] - range[0] + 1);
|
player.removeFromQueue(range[0], range[1] - range[0] + 1);
|
||||||
} else {
|
} else {
|
||||||
await res.stop(errorMsg('range is backwards, just like you'));
|
await msg.channel.send(errorMsg('range is backwards, just like you'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,18 +61,18 @@ export default class implements Command {
|
||||||
const index = parseInt(match[3], 10);
|
const index = parseInt(match[3], 10);
|
||||||
|
|
||||||
if (index < 1) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (index > player.queueSize()) {
|
if (index > player.queueSize()) {
|
||||||
await res.stop(errorMsg('queue isn\'t THAT big'));
|
await msg.channel.send(errorMsg('queue isn\'t THAT big'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
player.removeFromQueue(index, 1);
|
player.removeFromQueue(index, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
await res.stop('to the trash it goes :wastebasket:');
|
await msg.channel.send('to the trash it goes :wastebasket:');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue