From 9d40245696759611effc96dd277c104c1fc1b45a Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Wed, 9 Jun 2021 22:17:28 -0400 Subject: [PATCH] Fix bugs --- commands/games-sp/anime-score.js | 2 +- commands/games-sp/hunger-games.js | 1 + commands/search/anime.js | 2 +- commands/search/manga.js | 2 +- framework/Dispatcher.js | 8 +++++--- package.json | 2 +- 6 files changed, 10 insertions(+), 7 deletions(-) diff --git a/commands/games-sp/anime-score.js b/commands/games-sp/anime-score.js index c57f2dec..0aee7e5d 100644 --- a/commands/games-sp/anime-score.js +++ b/commands/games-sp/anime-score.js @@ -64,7 +64,7 @@ module.exports = class AnimeScoreCommand extends Command { .setImage(anime.coverImage.large || anime.coverImage.medium || null) .setTitle(anime.title.english || anime.title.romaji) .setDescription(`_${anime.startDate.year}, ${formats[anime.format]}_`) - .setFooter(anime.id); + .setFooter(anime.id.toString()); await msg.reply('**You have 15 seconds, what score do you think this anime has?**', { embed }); const filter = res => { if (res.author.id !== msg.author.id) return false; diff --git a/commands/games-sp/hunger-games.js b/commands/games-sp/hunger-games.js index c347df18..0db3e4da 100644 --- a/commands/games-sp/hunger-games.js +++ b/commands/games-sp/hunger-games.js @@ -1,4 +1,5 @@ const Command = require('../../framework/Command'); +const { MessageActionRow, MessageButton } = require('discord.js'); const { stripIndents } = require('common-tags'); const { shuffle, removeDuplicates, verify } = require('../../util/Util'); const events = require('../../assets/json/hunger-games'); diff --git a/commands/search/anime.js b/commands/search/anime.js index 1e453ba6..e8190b36 100644 --- a/commands/search/anime.js +++ b/commands/search/anime.js @@ -127,7 +127,7 @@ module.exports = class AnimeCommand extends Command { .setTitle(anime.title.english || anime.title.romaji) .setDescription(anime.description ? cleanAnilistHTML(anime.description) : 'No description.') .addField('❯ Status', statuses[anime.status], true) - .addField('❯ Episodes', anime.episodes || '???', true) + .addField('❯ Episodes', anime.episodes?.toString() || '???', true) .addField('❯ Season', anime.season ? `${seasons[anime.season]} ${anime.startDate.year}` : '???', true) .addField('❯ Average Score', anime.averageScore ? `${anime.averageScore}%` : '???', true) .addField(`❯ MAL Score`, malScore ? embedURL(malScore, malURL) : '???', true) diff --git a/commands/search/manga.js b/commands/search/manga.js index 5e6fed79..d26ceb78 100644 --- a/commands/search/manga.js +++ b/commands/search/manga.js @@ -121,7 +121,7 @@ module.exports = class MangaCommand extends Command { .setDescription(manga.description ? cleanAnilistHTML(manga.description) : 'No description.') .addField('❯ Status', statuses[manga.status], true) .addField('❯ Chapters / Volumes', `${manga.chapters || '???'}/${manga.volumes || '???'}`, true) - .addField('❯ Year', manga.startDate.year || '???', true) + .addField('❯ Year', manga.startDate.year?.toString() || '???', true) .addField('❯ Average Score', manga.averageScore ? `${manga.averageScore}%` : '???', true) .addField(`❯ MAL Score`, malScore ? embedURL(malScore, malURL) : '???', true) .addField(`❯ ${ANILIST_USERNAME}'s Score`, entry && entry.score ? `${entry.score}/10` : '???', true) diff --git a/framework/Dispatcher.js b/framework/Dispatcher.js index ae34533a..da1f7e47 100644 --- a/framework/Dispatcher.js +++ b/framework/Dispatcher.js @@ -39,9 +39,8 @@ module.exports = class CommandDispatcher { for (let i = 0; i < command.args.length; i++) { const arg = command.args[i]; if (arg.infinite) { - const infinite = parsed._.slice(i).map(j => j.toString()); - const parsedArgs = []; - for (const parsedArg of infinite) { + const infinite = parsed._.slice(i); + if (!infinite.length) { if (arg.isEmpty(parsedArg, msg, arg)) { if (arg.default) { finalResult[arg.key] = typeof arg.default === 'function' ? arg.default(msg) : arg.default; @@ -50,6 +49,9 @@ module.exports = class CommandDispatcher { return `The "${arg.label || arg.key}" argument is required.`; } } + } + const parsedArgs = []; + for (const parsedArg of infinite) { const valid = await arg.validate(parsedArg, msg, arg); if (!valid) return `An invalid value was provided for one of the "${arg.label || arg.key}" arguments.`; parsedArgs.push(await arg.parse(parsedArg, msg, arg)); diff --git a/package.json b/package.json index 81d451f7..50745978 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "141.0.0", + "version": "141.0.1", "description": "Your personal server companion.", "main": "Xiao.js", "private": true,