Team-Gigabyte / quotobot

Use const declarations for variables that are never reassigned JS-0242
Anti-pattern
Minor
6 days ago3 years old
'timeout' is never reassigned. Use 'const' instead
548        case "spellcheck":
549            if (envVars.QBSPELL != "off") {
550                (async () => {
551                    let timeout = envVars.QBSPTIMEOUT || 10000;552                    if (usedSpellingRecently.has(message.author.id)) return message.reply(embed.error(`You need to wait ${timeout / 1000} seconds before asking for spellcheck again.`, "ERR_RATE_LIMIT", "Slow down!"));
553                    if (args?.length < 1) return message.reply(embed.error("You didn't include any text to spell check.", "ERR_NO_TEXT", "Where's the text?"));
554                    if (args?.join().length > 500) return message.reply(embed.error("You can only spellcheck 500 characters at most.", "ERR_500_EXCEEDED", "Too long!"));
'mbed' is never reassigned. Use 'const' instead
498                    if (profile) profile = `https://ddragon.leagueoflegends.com/cdn/${LeagueAPI.getDDragonLocalDataVersion()}/img/profileicon/${profile}.png`;
499                    let addlData = await LeagueAPI.getLeagueRanking(acctObj) || [];
500                    message.channel.stopTyping(true);
501                    let mbed = embed.simple(502                        "", "", `League Info for ${acctObj.name}`)
503                        .setURL(`https://${opggRegions[LeagueAPI.region]}.op.gg/summoner/userName=${acctObj.name.replace(/ /g, "+")}`)
504                        .setFooter('Click the "League Info" title above to go to this summoner\'s OP.GG page.', icons.bulb)
'stockData' is never reassigned. Use 'const' instead
436                    }
437                    try {
438                        let gotData = await fetch(`https://finnhub.io/api/v1/quote?symbol=${args[0].toUpperCase()}&token=${configFile.stockToken || envVars.QBSTOCKS}`);
439                        let stockData = await gotData.json();440                        if (!gotData.ok) {
441                            message.reply(embed.error("There was an error getting stock info.", `${stockData.cod || gotData.status}: ${stockData.message || gotData.statusText}`));
442                            return;
'gotData' is never reassigned. Use 'const' instead
435                        return null;
436                    }
437                    try {
438                        let gotData = await fetch(`https://finnhub.io/api/v1/quote?symbol=${args[0].toUpperCase()}&token=${configFile.stockToken || envVars.QBSTOCKS}`);439                        let stockData = await gotData.json();
440                        if (!gotData.ok) {
441                            message.reply(embed.error("There was an error getting stock info.", `${stockData.cod || gotData.status}: ${stockData.message || gotData.statusText}`));
'timeout' is never reassigned. Use 'const' instead
359            break;
360        case "weathermetric":
361        case "weather": {
362            let timeout = configFile.weatherTimeout || envVars.QBWTIMEOUT || 15000363            if (usedWeatherRecently.has(message.author.id)) {
364                message.reply(embed.error(`You need to wait ${timeout / 1000} seconds before asking for the weather again.`, "ERR_RATE_LIMIT", "Slow down!"));
365            } else {