Skip to content

Commit

Permalink
fix(commands): languages update
Browse files Browse the repository at this point in the history
  • Loading branch information
eritislami committed Jan 21, 2021
1 parent d081b58 commit 9531591
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 13 deletions.
4 changes: 1 addition & 3 deletions commands/nowplaying.js
Expand Up @@ -30,9 +30,7 @@ module.exports = {
"[" +
createBar(song.duration == 0 ? seek : song.duration, seek, 20)[0] +
"]" +
(song.duration == 0
? i18n.__("nowplaying.live")
: new Date(song.duration * 1000).toISOString().substr(11, 8)),
(song.duration == 0 ? " ◉ LIVE" : new Date(song.duration * 1000).toISOString().substr(11, 8)),
false
);
nowPlaying.setFooter(
Expand Down
2 changes: 1 addition & 1 deletion commands/playlist.js
Expand Up @@ -87,7 +87,7 @@ module.exports = {
}

const newSongs = videos
.filter((video) => video.title != "Private video")
.filter((video) => video.title != "Private video" && video.title != "Deleted video")
.map((video) => {
return (song = {
title: video.title,
Expand Down
2 changes: 1 addition & 1 deletion commands/queue.js
Expand Up @@ -21,7 +21,7 @@ module.exports = {
const embeds = generateQueueEmbed(message, queue.songs);

const queueEmbed = await message.channel.send(
i18n.__mf("queue.currentPage", { page: currentPage + 1, length: embeds.length }),
`**${i18n.__mf("queue.currentPage")} ${currentPage + 1}/${embeds.length}**`,
embeds[currentPage]
);

Expand Down
13 changes: 5 additions & 8 deletions commands/remove.js
@@ -1,6 +1,5 @@
const { canModifyQueue, LOCALE } = require("../util/EvobotUtil");
const i18n = require("i18n");

i18n.setLocale(LOCALE);

const pattern = /^[0-9]{1,2}(\s*,\s*[0-9]{1,2})*$/g;
Expand All @@ -11,21 +10,19 @@ module.exports = {
description: i18n.__("remove.description"),
execute(message, args) {
const queue = message.client.queue.get(message.guild.id);

if (!queue) return message.channel.send(i18n.__("remove.errorNotQueue")).catch(console.error);
if (!canModifyQueue(message.member)) return i18n.__("common.errorNotChannel");
if (!args.length) return message.reply(i18n.__mf("remove.usageReply", { prefix: message.client.prefix }));

const arguments = args.join("");
const songs = arguments.split(",").map((str) => str.trim());
const songs = arguments.split(",").map((arg) => parseInt(arg));
let removed = [];

if (pattern.test(arguments) && songs.every((value) => value < queue.songs.length)) {
if (pattern.test(arguments) && songs.every((songIndex) => songIndex < queue.songs.length)) {
queue.songs = queue.songs.filter((item, index) => {
if (songs.every((value) => value - 1 != index)) {
return true;
} else {
removed.push(item);
}
if (songs.find((songIndex) => songIndex - 1 == index)) removed.push(item);
else return true;
});

queue.textChannel.send(
Expand Down

0 comments on commit 9531591

Please sign in to comment.