Advertisement
2wild4u

item.js

Jan 1st, 2020
547
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const Discord = require('discord.js');
  2.  
  3. module.exports.run = (message, args, tools) => {
  4. let pages = ['General Commands Page 1', 'General Command Page 2', 'General Commands Page 3'];
  5. let page = 1;
  6.  
  7. let embed03 = new Discord.RichEmbed()
  8. .setColor("#15f153")
  9. .setDescription(pages[page-1])
  10. .setFooter(`Page ${page} of ${pages.length}`)
  11. .addField("field 1")
  12. .addField("field 2")
  13. .addField("!field 3")
  14. .addField("field 4")
  15.  
  16. message.channel.send(embed03).then(msg => {
  17.  
  18. msg.react('⏪').then( r => {
  19. msg.react('⏩')
  20.  
  21. // Filters
  22. const backwardsFilter = (reaction, user) => reaction.emoji.name === '⏪' && user.id === message.author.id;
  23. const forwardsFilter = (reaction, user) => reaction.emoji.name === '⏩' && user.id === message.author.id;
  24.  
  25. const backwards = msg.createReactionCollector(backwardsFilter, {timer: 1000});
  26. const forwards = msg.createReactionCollector(forwardsFilter, {timer: 1000});
  27.  
  28. backwards.on('collect', r => {
  29.     if (page !== 1) {
  30.     page--;
  31.     embed03.setDescription(pages[page-1])
  32.     embed03.setFooter(`Page ${page} of ${pages.length}`);
  33.     msg.edit(embed03)
  34.     }
  35. })
  36.  
  37. forwards.on('collect', r => {
  38. if (page === pages.length) return;
  39. page++;
  40. embed.setDescription(pages[page-1]);
  41. embed.setFooter(`Page ${page} of ${pages.length}`);
  42. msg.edit(embed)
  43. })
  44. })
  45.  
  46. })
  47. }
  48. module.exports.config = {
  49. name: "items",
  50. aliases: ["items"],
  51. usage: "item",
  52. description: "",
  53. accessableby: "Members"
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement