nyx

The first CODM discrod bot -- cath.exe Template
git clone https://codeberg.org/night0721/nyx
Log | Files | Refs | LICENSE

loadout.js (2517B)


      1 const { EmbedBuilder } = require("discord.js"); //@night0721 You need to make this
      2 const items = require("../../util/Data/loadout.json");
      3 module.exports = {
      4   name: "class",
      5   description: "Generate A Random Loadout",
      6   category: "CODM",
      7   run: async (client, interaction) => {
      8     // const data = async () => {
      9     //   const d = await model.findOne({});
     10     //   const types = d.Categories;
     11     //   const names = d.Primary;
     12     //   const category = types[Math.floor(Math.random() * types.length)];
     13     //   const weapons = names[0][category];
     14     //   return `${weapons[Math.floor(Math.random() * weapons.length)]}`;
     15     // };
     16     // const primary_weapon = await data();
     17     // const primary = primary_weapon.replace(/[ -]/g, "_").replace(/\./g, "");
     18     // const slots = shuffle(Object.keys(Attachments[primary][0]));
     19     // const slot_1 = slots.next().value,
     20     //   slot_2 = slots.next().value,
     21     //   slot_3 = slots.next().value,
     22     //   slot_4 = slots.next().value,
     23     //   slot_5 = slots.next().value;
     24     const result = new EmbedBuilder()
     25       .setColor(client.color)
     26       .setFooter({ text: `Made by ${client.author}` })
     27       .setURL(client.web)
     28       .setTitle(`🎲 A Randomly Generated Loadout 🎲`)
     29       .setDescription(
     30         `This loadout is a randomly generated, Also try, \`/class\` to get a randomally generated primary weapon gunsmith build`
     31       )
     32       .addFields(
     33         {
     34           name: `Secondary Weapon`,
     35           value: ``,
     36           inline: true,
     37         },
     38         {
     39           name: `Operator Skill`,
     40           value: ``,
     41           inline: true,
     42         },
     43         {
     44           name: `Scorestreak`, // 3 perks
     45           value: ``,
     46           inline: true,
     47         },
     48         {
     49           name: `🔴 Red Perk`,
     50           value: ``,
     51           inline: true,
     52         },
     53         {
     54           name: `🟢 Green Perk`,
     55           value: ``,
     56           inline: true,
     57         },
     58         {
     59           name: `🔵 Blue Perk`,
     60           value: ``,
     61           inline: true,
     62         }
     63       )
     64       .setTimestamp();
     65     interaction.followUp({ embeds: [result] });
     66 
     67     // function* shuffle(array) {
     68     //   let i = array.length;
     69     //   while (i--) {
     70     //     yield array.splice(Math.floor(Math.random() * (i + 1)), 1)[0];
     71     //   }
     72     // }
     73     // function getAttachment(gun, slot) {
     74     //   const ca = Attachments[gun][0][slot];
     75     //   return ca[Math.floor(Math.random() * ca.length)];
     76     // }
     77   },
     78 };