Update strings

This commit is contained in:
Max Isom 2021-11-20 18:58:40 -05:00
parent 7538a2ebb8
commit 490b082587
No known key found for this signature in database
GPG key ID: 25C9B1A7F6798880
2 changed files with 10 additions and 13 deletions

View file

@ -131,7 +131,6 @@ export default class implements Command {
if (song) { if (song) {
newSongs.push(song); newSongs.push(song);
} else { } else {
console.log(_);
await res.stop(errorMsg('that doesn\'t exist')); await res.stop(errorMsg('that doesn\'t exist'));
return; return;
} }

View file

@ -10,8 +10,8 @@ export default class implements Command {
public name = 'remove'; public name = 'remove';
public aliases = ['rm']; public aliases = ['rm'];
public examples = [ public examples = [
['remove 1', 'removes the first song in the queue (not the one thats playing, just skip it dummy)'], ['remove 1', 'removes the next song in the queue'],
['rm 6-9', 'removes the every song in range [6-9] from the queue'], ['rm 5-7', 'remove every song in range 5 - 7 (inclusive) from the queue'],
]; ];
private readonly playerManager: PlayerManager; private readonly playerManager: PlayerManager;
@ -24,7 +24,7 @@ export default class implements Command {
const player = this.playerManager.get(msg.guild!.id); const player = this.playerManager.get(msg.guild!.id);
if (args.length === 0) { if (args.length === 0) {
await msg.channel.send('atleast give me a clue for which song you want to remove'); await msg.channel.send(errorMsg('missing song position or range'));
return; return;
} }
@ -32,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 msg.channel.send(errorMsg('incorrect format, just an index or start-end format')); await msg.channel.send(errorMsg('incorrect format'));
return; return;
} }
@ -40,39 +40,37 @@ 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 msg.channel.send(errorMsg('you start counting with 1')); await msg.channel.send(errorMsg('position must be greater than 0'));
return; return;
} }
if (range[1] > player.queueSize()) { if (range[1] > player.queueSize()) {
await msg.channel.send(errorMsg('queue isn\'t THAT big')); await msg.channel.send(errorMsg('position is outside of the queue\'s range'));
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 msg.channel.send(errorMsg('range is backwards, just like you')); await msg.channel.send(errorMsg('range is backwards'));
return; return;
} }
console.log(range);
} else { // 3rd group exists -> just one song } else { // 3rd group exists -> just one song
const index = parseInt(match[3], 10); const index = parseInt(match[3], 10);
if (index < 1) { if (index < 1) {
await msg.channel.send(errorMsg('it\'s got be bigger than 0, chief')); await msg.channel.send(errorMsg('position must be greater than 0'));
return; return;
} }
if (index > player.queueSize()) { if (index > player.queueSize()) {
await msg.channel.send(errorMsg('queue isn\'t THAT big')); await msg.channel.send(errorMsg('position is outside of the queue\'s range'));
return; return;
} }
player.removeFromQueue(index, 1); player.removeFromQueue(index, 1);
} }
await msg.channel.send('to the trash it goes :wastebasket:'); await msg.channel.send(':wastebasket: removed');
} }
} }