diff --git a/commands/help_embeds/generate_help.js b/commands/help_embeds/generate_help.js index adc5c56..cf1627e 100644 --- a/commands/help_embeds/generate_help.js +++ b/commands/help_embeds/generate_help.js @@ -1,36 +1,37 @@ +// const Discord = require('discord.js'); const generateHelp = (message, client, generateEmbed, commandAmount) => { - message.reactions.removeAll(); + message.reactions.removeAll().catch(err => console.log(err)); - var currentIndex = 0; + let currentIndex = 0; message.edit(generateEmbed(currentIndex)).then(message => { let emojiArray = ['⬅️', '➡️', '⏮']; if (commandAmount > 1) { for (i = 0; i < emojiArray.length; i++) { - message.react(emojiArray[i]); + message.react(emojiArray[i]).catch(err => console.log(err)); } - } else message.react('⏮'); + } else message.react('⏮').catch(err => console.log(err)); const filter = (reaction, user) => { return (emojiArray.includes(reaction.emoji.name)) && user.id != message.author.id; }; - const collector = message.createReactionCollector(filter, { time: 180000 }); + const collector = message.createReactionCollector(filter, { time: 120000 }); collector.on('collect', (reaction, user) => { if (reaction.emoji.name === '➡️') { if (currentIndex < commandAmount - 1) { currentIndex++; - message.edit(generateEmbed(currentIndex)); + message.edit(generateEmbed(currentIndex)).catch(err => console.log(err)); } } else if (reaction.emoji.name === '⬅️') { if (currentIndex > 0) { currentIndex--; - message.edit(generateEmbed(currentIndex)); + message.edit(generateEmbed(currentIndex)).catch(err => console.log(err)); } } else { client.commands.get('help').execute(message, client); - message.delete(); + message.delete().catch(err => console.log(err)); } }); }).catch(err => console.log(err));