INNER CODE UNIT · JavaScript

commandIndex

3eif/ear-tensifier · src/helpers/DatabaseHelper.js:38

                        const commandIndex = bot.commands.findIndex(c => c._id === cmd.name);
                        if (commandIndex === -1) {
                            bot.updateOne({ commands: [...bot.commands, { _id: cmd.name, timesUsed: 1 }] }).catch(e => this.logger.error(e));
                        }
                        else {
                            bot.updateOne({ commands: [...bot.commands.slice(0, commandIndex), { _id: cmd.name, timesUsed: bot.commands[commandIndex].timesUsed + cmd.timesUsed }, ...bot.commands.slice(commandIndex + 1)] }).catch(e => this.logger.error(e));
                        }
                    }
                    resolve();
                });
            });

            // const updateSongs = new Promise((resolve) => {
            //     for (let i = 0; i < this.client.timesSongsPlayed.length; i++) {
            //         const song = this.client.timesSongsPlayed[i];
            //         if (song.url) {
            //             Song.findById(song.url).then(async s => {
            //                 if (!s) {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…