Skip to content
Advertisement

Embed React Pages Discord Js

i made a bot Help command list by saying ” 911 ” in chat . It gives u an embed with the commands and 3 react buttons “forward” “backward” “delete” . It works as intended but idk why I can only use the reaction buttons once . For example : i am on page 1 , i pressed to go forward to 2 , then backward to 1 BUT if i want forward to 2 again it doesn’t respond anymore.

PICTURE OF HOW IT LOOKS LIKE IN DISCORD CHAT : https://imgur.com/a/ndVjI79

  {            
               
               const embed = new Discord.MessageEmbed()
                
                .setDescription("*:vertical_traffic_light: :police_car: 911 / 112 / help for emergencies :police_car: :vertical_traffic_light:*")
                .setAuthor("**Necrophilia Police**")
                .setThumbnail('https://cdn.discordapp.com/avatars/766629801078685716/7daaa149ec7a8096357eda7805a56ecc.png?size=128')
                .setColor(0xC41E35)
                .setTitle("Commands for both DM and Server Messages")
                .addField("***:white_check_mark: For SERVER Messages:***", ":moneybag: `sunt horny ==> You are sent to horny jail`")
                .addField(":moneybag: `esti horny +tag ==> He/She is sent to horny jail`", ":moneybag: `nu sunt horny ==> Congrats from Garcea`")
                .addField(":moneybag: `nu este horny +tag ==> He/She congrats from Garcea`", ":moneybag: `what's your wisdom ==> Garcea's Wisdom`")
                .addField(":moneybag: `kekekek.... ==> Garcea laughs with you`", ":moneybag: `testos ==> testosu' ninja`")
                .addField(":moneybag: `fight/challenge/duel +anything ==> Prepare yo ass`", ":moneybag: `peepo the pet ==> Sending best meme`")
                .addField(":moneybag: `drug/drog/droage +anything ==> Garcea comes for you`", ":moneybag: `quiz ==> A quiz made by Garcea`")
                .addField(":moneybag: `today/time/day/date ==> Date and Time`", ":moneybag: `monke ==> mmmm M O N K E`")
                .addField(":moneybag: `-weather +location ==> Weather`", "`Example: -weather Iasi`")
                .addField(":moneybag: `-hangman ==> hangman minigame`", ":moneybag: `-random ==> random cursed image`")
                .addField(":moneybag: `-random +anything ==> random image of mention`", "`Example: -random cow ==> random cow image`")
                .addField(":moneybag: `vibe/vibing ==> Vibe Checking`", ":moneybag: `cat the bread ==> Sending 2nd meme`")
                message.channel.send({embed})
                        .then(m => {
                      m.react('➡️');

                       const filter = (reaction, user) => reaction.emoji.name === '➡️' && user.id === message.author.id;
                       const collector = m.createReactionCollector(filter, { max: 1, time: 5 * 60 * 1000 }); // 5 min
                      
                       collector.on('collect', async (reaction, user) => {
                       
                       reaction.users.remove(user.id);
                   
               var embed = new Discord.MessageEmbed()
                 .setDescription("*:vertical_traffic_light: :police_car: 911 / 112 / help for emergencies :police_car: :vertical_traffic_light:*")
                .setAuthor("**Necrophilia Police**")
                .setThumbnail('https://cdn.discordapp.com/avatars/766629801078685716/7daaa149ec7a8096357eda7805a56ecc.png?size=128')
                .setColor(0xC41E35)
                .setTitle("Commands for both DM and Server Messages")      
                .addField("***:white_check_mark: For DMs :***", ":moneybag: `-weather +location ==> Weather`")
                .addField(":moneybag: `hi/hello/howdy/hola/hey  ==> Garcea HIes you back`", ":moneybag: `drug/drog/droage +any ==> you'd better not say`")
                .addField(":moneybag: `fight/duel/challenge +anything ==> He beats yo ass`", ":moneybag: `today/time/day/date ==> Date and Time`")
                .addField(":moneybag: `quiz ==> A quiz made by Garcea`", ":moneybag: `how are you ==> Garcea's feelings`")
                .addField(":moneybag: `-hangman ==> hangman minigame`", ":moneybag: `anything besides commands ==> Something crazy`")
                .addField(":moneybag: `-random ==> random cursed image`", ":moneybag: `-random +anything ==> random image of mention`")
                .addField("`Example: -random cow ==> random cow image`", ":moneybag: `vibe/vibing ==> Vibe Checking`")
                       m.edit({embed});
                                             });
               
                 m.react("⬅️");
                       const filter2 = (reaction, user) => reaction.emoji.name === '⬅️' && user.id === message.author.id;
                       const collector2 = m.createReactionCollector(filter2, { max: 1, time: 5 * 60 * 1000 }); // 5 min
                      
                       collector2.on('collect', async (reaction, user) => {
                       
                       reaction.users.remove(user.id);

                var embed = new Discord.MessageEmbed()
                .setDescription("*:vertical_traffic_light: :police_car: 911 / 112 / help for emergencies :police_car: :vertical_traffic_light:*")
                .setAuthor("**Necrophilia Police**")
                .setThumbnail('https://cdn.discordapp.com/avatars/766629801078685716/7daaa149ec7a8096357eda7805a56ecc.png?size=128')
                .setColor(0xC41E35)
                .setTitle("Commands for both DM and Server Messages")
                .addField("***:white_check_mark: For SERVER Messages:***", ":moneybag: `sunt horny ==> You are sent to horny jail`")
                .addField(":moneybag: `esti horny +tag ==> He/She is sent to horny jail`", ":moneybag: `nu sunt horny ==> Congrats from Garcea`")
                .addField(":moneybag: `nu este horny +tag ==> He/She congrats from Garcea`", ":moneybag: `what's your wisdom ==> Garcea's Wisdom`")
                .addField(":moneybag: `kekekek.... ==> Garcea laughs with you`", ":moneybag: `testos ==> testosu' ninja`")
                .addField(":moneybag: `fight/challenge/duel +anything ==> Prepare yo ass`", ":moneybag: `peepo the pet ==> Sending best meme`")
                .addField(":moneybag: `drug/drog/droage +anything ==> Garcea comes for you`", ":moneybag: `quiz ==> A quiz made by Garcea`")
                .addField(":moneybag: `today/time/day/date ==> Date and Time`", ":moneybag: `monke ==> mmmm M O N K E`")
                .addField(":moneybag: `-weather +location ==> Weather`", "`Example: -weather Iasi`")
                .addField(":moneybag: `-hangman ==> hangman minigame`", ":moneybag: `-random ==> random cursed image`")
                .addField(":moneybag: `-random +anything ==> random image of mention`", "`Example: -random cow ==> random cow image`")
                .addField(":moneybag: `vibe/vibing ==> Vibe Checking`", ":moneybag: `cat the bread ==> Sending 2nd meme`")
                        m.edit({embed});
                   
                                });
                m.react("❌");
                       const filter3 = (reaction, user) => reaction.emoji.name === '❌' && user.id === message.author.id;
                       const collector3 = m.createReactionCollector(filter3, { max: 1, time: 5 * 60 * 1000 }); // 5 min
                       
                        collector3.on('collect', async (reaction, user) => {
                       
                        reaction.users.remove(user.id);
                        m.delete()

                          });
              });


  }

Advertisement

Answer

m.createReactionCollector(filter, { max: 1, time: 5 * 60 * 1000 })

the max value you have specified here is the maximum amount of reactions to collect. You can increase the max value to a high amount or just remove the option if you don’t want to limit the maximum amount of reactions.

You might also want to add a collecter2.on(‘end’) and remove all the reactions and edit the embed to reflect that it has stopped collecting reactions.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement