Nimbi

menu.ts

Nov 18th, 2020 (edited)
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import { config } from '../../modules/config/cfg';
  2.  
  3. var MSGID = '';
  4. var AUTHORID = '';
  5. var guildId = config.guildId;
  6.  
  7. config.commands.handler.raw(
  8.   {
  9.     name: 'menu',
  10.     aliases: ['help', 'h', 'cmd', 'commands', 'cmds', 'cmdhelp', 'chelp'],
  11.     description: 'Pylon Help Menu',
  12.     filters: config.modules.permissions.user
  13.   },
  14.   async (msg) => {
  15.     const guild = await discord.getGuild();
  16.     const menu = new discord.Embed();
  17.     await menu.setColor(config.embeds.COLOR);
  18.     await menu.setFooter({
  19.       text: config.msg.FOOTER_TEXT,
  20.       iconUrl: `${guild.getIconUrl(discord.ImageType.PNG)}`
  21.     });
  22.     await menu.setTitle('Pylon Help Menu');
  23.     await menu.setDescription(
  24.       `Select an option to see what commands are available.\n
  25. \\${config.emoji.GEAR} **Administration Commands**
  26. \\${config.emoji.WRENCH} **Moderatoration Commands**
  27. \\${config.emoji.SOCIAL} **Social Commands**
  28. \\${config.emoji.TOOLS} **Utility Commands**
  29. \\${config.emoji.MONEY} **Economy Commands**
  30. \\${config.emoji.EXIT} **Cancel**
  31. `
  32.     );
  33.  
  34.     if (
  35.       !config.modules.util.enabled &&
  36.       !config.modules.util.commands.menu.enabled
  37.     )
  38.       return;
  39.  
  40.     const thehelpmsg = await msg.reply(menu);
  41.  
  42.     await thehelpmsg.addReaction(config.emoji.GEAR); //** Adminstrator commands */
  43.     await thehelpmsg.addReaction(config.emoji.WRENCH); //** Moderator Commands */
  44.     await thehelpmsg.addReaction(config.emoji.SOCIAL); //** Social Commands */
  45.     await thehelpmsg.addReaction(config.emoji.TOOLS); //** Utility Commands */
  46.     await thehelpmsg.addReaction(config.emoji.MONEY); //** Economy Commands */
  47.     await thehelpmsg.addReaction(config.emoji.EXIT); //** Cancel */
  48.  
  49.     MSGID = thehelpmsg.id;
  50.     AUTHORID = msg.author.id;
  51.   }
  52. );
  53.  
  54. discord.registerEventHandler('MESSAGE_REACTION_ADD', async (theReaction) => {
  55.   const guild = await discord.getGuild(guildId);
  56.   const theMsgChannel = await discord.getGuildTextChannel(
  57.     theReaction.channelId
  58.   );
  59.   const theMsg = await theMsgChannel.getMessage(theReaction.messageId);
  60.  
  61.   if (
  62.     theReaction.emoji.name == config.emoji.GEAR && //** Administration Commands */
  63.     theReaction.messageId == MSGID &&
  64.     theReaction.member.user.id == AUTHORID
  65.   ) {
  66.     const option1 = new discord.Embed();
  67.     await option1.setColor(0x3f888f);
  68.     await option1.setTitle(
  69.       config.emoji.GEAR + ' __Administration Commands__ ' + config.emoji.GEAR
  70.     );
  71.     await option1.setDescription(
  72.       `\`\`\`yaml\n${config.msg.ADMIN_COMMANDS}\`\`\``
  73.     );
  74.     const theMsg1 = await theMsg.reply(option1);
  75.     MSGID = '';
  76.     AUTHORID = '';
  77.     await theMsg.delete();
  78.   }
  79.   if (
  80.     theReaction.emoji.name == config.emoji.WRENCH && //** Moderation Commands */
  81.     theReaction.messageId == MSGID &&
  82.     theReaction.member.user.id == AUTHORID
  83.   ) {
  84.     const option2 = new discord.Embed();
  85.     await option2.setColor(0x3f888f);
  86.     await option2.setTitle(
  87.       config.emoji.WRENCH + ' __Moderation Commands__ ' + config.emoji.WRENCH
  88.     );
  89.     await option2.setDescription(
  90.       `\`\`\`yaml\n${config.msg.MOD_COMMANDS}\`\`\``
  91.     );
  92.     const theMsg2 = await theMsg.reply(option2);
  93.     MSGID = '';
  94.     AUTHORID = '';
  95.     await theMsg.delete();
  96.   }
  97.   if (
  98.     theReaction.emoji.name == config.emoji.SOCIAL && //** Social Commands */
  99.     theReaction.messageId == MSGID &&
  100.     theReaction.member.user.id == AUTHORID
  101.   ) {
  102.     const option3 = new discord.Embed();
  103.     await option3.setColor(0x3f888f);
  104.     await option3.setTitle(
  105.       config.emoji.SOCIAL + ' __Social Commands__ ' + config.emoji.SOCIAL
  106.     );
  107.     await option3.setDescription(
  108.       `\`\`\`yaml\n${config.msg.SOCIAL_COMMANDS}\`\`\``
  109.     );
  110.  
  111.     if (
  112.       !config.modules.util.enabled &&
  113.       !config.modules.util.commands.menu.enabled
  114.     )
  115.       return;
  116.  
  117.     const theMsg3 = await theMsg.reply(option3);
  118.     MSGID = '';
  119.     AUTHORID = '';
  120.     await theMsg.delete();
  121.   }
  122.   if (
  123.     theReaction.emoji.name == config.emoji.TOOLS && //** Utility Commands */
  124.     theReaction.messageId == MSGID &&
  125.     theReaction.member.user.id == AUTHORID
  126.   ) {
  127.     const option4 = new discord.Embed();
  128.     await option4.setColor(0x3f888f);
  129.     await option4.setTitle(
  130.       config.emoji.TOOLS + ' __Utility Commands__ ' + config.emoji.TOOLS
  131.     );
  132.     await option4.setDescription(
  133.       `\`\`\`yaml\n${config.msg.UTIL_COMMANDS}\`\`\``
  134.     );
  135.  
  136.     if (
  137.       !config.modules.util.enabled &&
  138.       !config.modules.util.commands.menu.enabled
  139.     )
  140.       return;
  141.  
  142.     const theMsg4 = await theMsg.reply(option4);
  143.     MSGID = '';
  144.     AUTHORID = '';
  145.     await theMsg.delete();
  146.   }
  147.   if (
  148.     theReaction.emoji.name == config.emoji.MONEY && //** Economy Commands */
  149.     theReaction.messageId == MSGID &&
  150.     theReaction.member.user.id == AUTHORID
  151.   ) {
  152.     const option5 = new discord.Embed();
  153.     await option5.setColor(0x3f888f);
  154.     await option5.setTitle(
  155.       config.emoji.MONEY + ' __Economy Commands__ ' + config.emoji.MONEY
  156.     );
  157.     await option5.setDescription(
  158.       `\`\`\`yaml\n${config.msg.ECONOMY_COMMANDS}\`\`\``
  159.     );
  160.  
  161.     if (
  162.       !config.modules.util.enabled &&
  163.       !config.modules.util.commands.menu.enabled
  164.     )
  165.       return;
  166.  
  167.     const theMsg5 = await theMsg.reply(option5);
  168.     MSGID = '';
  169.     AUTHORID = '';
  170.     await theMsg.delete();
  171.   }
  172.   if (
  173.     theReaction.emoji.name == config.emoji.EXIT && //** Cancel */
  174.     theReaction.messageId == MSGID &&
  175.     theReaction.member.user.id == AUTHORID
  176.   ) {
  177.     const option8 = new discord.Embed();
  178.     await option8.setColor(0x3f888f);
  179.     await option8.setTitle('**Canceled**');
  180.     await option8.setDescription(config.msg.MENU_RESPONSE_1);
  181.  
  182.     if (
  183.       !config.modules.util.enabled &&
  184.       !config.modules.util.commands.menu.enabled
  185.     )
  186.       return;
  187.  
  188.     const theMsg8 = await theMsg.reply(option8);
  189.     MSGID = '';
  190.     AUTHORID = '';
  191.     await theMsg.delete();
  192.   }
  193. });
  194.  
Add Comment
Please, Sign In to add comment