fix: show weather for cities that contains space in the name

This commit is contained in:
GiovaniFZ 2024-09-16 15:34:31 -03:00
parent 30a24ff36f
commit 368e54594b
No known key found for this signature in database
GPG Key ID: 63DD92181B575322

View File

@ -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 {