text: let {
        MessageEmbed,
        MessageActionRow,
        MessageButton,
        Discord,
  } = require("discord.js");
  const currency = require(`../../schemas/leveling`);
  3;
  let CurrencyEmoji = "⏣ ";
  
  module.exports = {
        name: "slots",
        description:
              "A command to gamble your coins. You can lose all of your coins though...",
        /**
         *
         * @param {Client} client
         * @param {Message} message
         * @param {String[]} args
         */
        run: async (client, message, args) => {
              const slotItems = ["🕰", "📜", "🕯", "☕", "🕯️", "️🏛️", "🥀"];
              let colours = ["#362222", "#B3541E", "#876445"];
  
              let user = message.author;
  
              let profile;
              try {
                    profile = await currency.findOne({
                          userID: user.id,
                    });
                    if (!profile) {
                          profile = await currency.create({
                                userID: user.id,
                                coins: 500,
                                bank: 0,
                                snowballs: 0,
                                hits: 0,
                          });
                          profile.save();
                    }
              } catch (err) {
                    console.log(err);
              }
  
              if (!args[0])
                    return message.channel.send(
                          `Specify amount to put into the slots machine!`
                    );
              let bet;
  
              if (isNaN(args[0])) {
                    if (args[0] !== "all" || args[0] !== "max") {
                          return message.channel.send(
                                `Please specify a valid amount!`
                          );
                    } else {
                          bet = profile.coins;
                    }
              } else {
                    bet = Number(args[0]);
              }
  
              if (bet < 50)
                    return message.channel.send(
                          `You can't gamble less than **⏣ 50**. Sorry, not sorry-`
                    );
  
              if (1 > bet > profile.coins) {
                    return message.reply({
                          content: `You can't bet more than you have, or less than 1 coin.`,
                    });
              }
  
              if (bet > 500) {
                    return message.reply({
                          content: `Please specify a valid number under 500.`,
                    });
              }
              let money = Math.round(bet);
  
              let win = false;
              let number = [];
              for (i = 0; i < 3; i++) {
                    number[i] =
                          slotItems[Math.floor(Math.random() * slotItems.length)];
              }
  
              if (number[0] == number[1] && number[1] == number[2]) {
                    money *= 9;
                    win = true;
              } else if (
                    number[0] == number[1] ||
                    number[0] == number[2] ||
                    number[1] == number[2]
              ) {
                    money *= 2;
                    win = true;
              }
              if (win) {
                    try {
                          await currency.findOneAndUpdate(
                                {
                                      userID: message.author.id,
                                },
                                {
                                      $inc: {
                                            coins: money,
                                      },
                                }
                          );
                    } catch (err) {
                          console.log(err);
                    }
                    let balance = parseFloat(profile.coins + money);
  
                    let slotsEmbed1 = new MessageEmbed()
                          .setTitle(`${message.author.username}'s Slot Machine`)
                          .setDescription(
                                `**>** ${[number[0]]} ${[number[1]]} ${[
                                      number[2],
                                ]} **<**
   
              You won **${CurrencyEmoji}${money}** coins.
              You now have **${CurrencyEmoji}${balance}** coins.`
                          )
                          .setFooter({
                                text: `winner winner`,
                          })
                          .setColor(
                                `${
                                      colours[
                                            Math.floor(
                                                  Math.random() * colours.length
                                            )
                                      ]
                                }`
                          );
  
                    let slotsEmbed2 = await message.reply({
                          embeds: [slotsEmbed1],
                    });
              } else {
                    try {
                          await currency.findOneAndUpdate(
                                {
                                      userID: message.author.id,
                                },
                                {
                                      $inc: {
                                            coins: -money,
                                      },
                                }
                          );
                    } catch (err) {
                          console.log(err);
                    }
                    let balance = parseFloat(profile.coins - money);
                    let slotsEmbed3 = new MessageEmbed()
                          .setTitle(`${message.author.username}'s Slot Machine`)
                          .setDescription(
                                `**>** ${[number[0]]} ${[number[1]]} ${[
                                      number[2],
                                ]} **<**
   
              You lost **${CurrencyEmoji}${money}** coins.
              You now have **${CurrencyEmoji}${balance}** coins.`
                          )
                          .setFooter({
                                text: `sucks to suck`,
                          })
                          .setColor(
                                `${
                                      colours[
                                            Math.floor(
                                                  Math.random() * colours.length
                                            )
                                      ]
                                }`
                          );
  
                    let slotsEmbed4 = await message.reply({
                          embeds: [slotsEmbed3],
                    });
              }
        },
  };