Nimbi

commands/menu.ts

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