From 368e54594b0e3816257128cdfebe3d2f06571911 Mon Sep 17 00:00:00 2001 From: GiovaniFZ Date: Mon, 16 Sep 2024 15:34:31 -0300 Subject: [PATCH] fix: show weather for cities that contains space in the name --- commands/weather.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/commands/weather.js b/commands/weather.js index 3062301..3c28c3c 100644 --- a/commands/weather.js +++ b/commands/weather.js @@ -36,16 +36,16 @@ module.exports = (bot) => { bot.command(['clima', 'weather'], spamwatchMiddleware, async (ctx) => { const userLang = ctx.from.language_code || "en-US"; const Strings = getStrings(userLang); - const args = ctx.message.text.split(' '); + const args = ctx.message.text; - if (args.length !== 2) { + if (args.length < 9) { return ctx.reply(Strings.provideLocation, { parse_mode: "Markdown", reply_to_message_id: ctx.message.message_id }); } - const location = args[1]; + const location = args.slice(9); const apiKey = Config.weatherKey; try {