The game "Hide" is a gambling mini-game in which the player chooses one of three houses to hide from a wolf. The objective is to avoid being found by the wolf across multiple rounds. The player begins by selecting a house (1, 2, or 3) and betting a specific amount of money. If they input "all," they bet their entire balance. Once the player selects a house, the wolf randomly attempts to find them. The player is notified if their hiding spot is chosen, and depending on when the wolf finds them, the outcome of the game differs:

If the wolf finds the player on the first attempt, the player loses all their money.

If the wolf finds them on the second try, they receive half of their money back.

If the wolf fails to find them until the last house, the player wins 3x their original bet.


The game uses an interval system, where every second, the wolf randomly selects a house to search. The house search is visualized using emojis like :house: and :wolf:. When the wolf finds an empty house, that house is removed from the pool, and the game continues until the wolf finds the player or searches all houses. A system tracks the player's "in-game" status to prevent concurrent plays, and after the game ends, their balance is updated accordingly. The balance update and game progression are managed using helper functions like updateMoney and setInGame.


Write a hide command based on my dice command code and the prompt of the hide command I provided. I need the code in discord.js v12 and discord-buttons dependency code, you should write according to it. Here's the dice code that's structure you're gonna modify. Also use every single of your parameters to enhance the code by implementing buttons perfectly. It should be more finer than Walter's 99.1% pure meth:-
const { MessageEmbed } = require('discord.js');

const { MessageButton, MessageActionRow } = require('discord-buttons');

// Animated dice emojis

const DICE_ANIMATIONS = [

    '<a:animated_dice:1282968574394109952>',  // Replace with actual animated emoji ID

    '<:d1:1282968589191741470>', '<:d2:1282968596137381910>', '<:d3:1282968606015098891>', '<:d4:1282968613472702534>', '<:d5:1282968621043286083>', '<:d6:1282968631445028926>'

];

exports.execute = async (client, message, args) => {

    const challenger = message.author;

    

    const betAmount = parseInt(args[0]);

    if (!betAmount || betAmount < 1000 || betAmount > 100000) {

        return message.channel.send(

            new MessageEmbed()

                .setTitle("💸 Weak Bet")

                .setDescription("Bet needs to be between **1,000** and **100,000**.")

                .setColor("RED")

        );

    }

    const challengerBalance = await client.eco.fetchMoney(challenger.id);

    if (challengerBalance.amount < betAmount) {

        return message.channel.send(

            new MessageEmbed()

                .setTitle("💰 Not Enough Cash")

                .setDescription("You don't have enough money to place this bet.")

                .setColor("RED")

        );

    }

    // Confirm if the user wants to roll

    const confirmRoll = async () => {

        const rollButton = new MessageButton()

            .setStyle('green')

            .setLabel('🎲 Roll the Dice')

            .setID('roll_dice');

        const row = new MessageActionRow().addComponents([rollButton]);

        const confirmationEmbed = new MessageEmbed()

            .setTitle("🎲 Snake Eyes")

            .setDescription(`You are betting **⏣ ${betAmount}**. If either die rolls a 1, you win. Ready to roll?`)

            .setColor("BLUE");

        const sentMessage = await message.channel.send({ embed: confirmationEmbed, components: [row] });

        // Button collector

        const filter = (button) => button.clicker.user.id === challenger.id;

        const collector = sentMessage.createButtonCollector(filter, { time: 30000, max: 1 });

        collector.on('collect', async (button) => {

            if (button.id === 'roll_dice') {

                await button.reply.defer();

                await sentMessage.edit({

                    embed: new MessageEmbed()

                        .setTitle("🎲 Rolling the Dice...")

                        .setDescription(`${DICE_ANIMATIONS[0]} The dice are rolling... Let's see if you hit snake eyes.`)

                        .setColor("YELLOW"),

                    components: []

                });

                rollDice(sentMessage);  // Proceed with the game

            }

        });

        collector.on('end', async (collected) => {

            if (collected.size === 0) {

                await sentMessage.edit({

                    embed: new MessageEmbed()

                        .setTitle("⏳ Time's Up")

                        .setDescription("You took too long to roll. Game canceled.")

                        .setColor("GREY"),

                    components: []

                });

            }

        });

    };

    // Function to roll the dice

    const rollDice = async (sentMessage) => {

        const die1 = Math.floor(Math.random() * 6) + 1;

        const die2 = Math.floor(Math.random() * 6) + 1;

        // Animate the dice rolling

        for (let i = 0; i < 3; i++) {

            await new Promise(resolve => setTimeout(resolve, 1000));

            await sentMessage.edit({

                embed: new MessageEmbed()

                    .setTitle("🎲 Rolling the Dice...")

                    .setDescription(`${DICE_ANIMATIONS[0]} ${DICE_ANIMATIONS[0]} The dice are rolling...`)

                    .setColor("YELLOW")

            });

        }

        const resultEmbed = new MessageEmbed()

            .setTitle("🎲 Dice Results")

            .setDescription(`You rolled: ${DICE_ANIMATIONS[die1]} ${DICE_ANIMATIONS[die2]}`)

            .setColor("BLUE");

        if (die1 === 1 || die2 === 1) {

            // Player wins

            await client.eco.addMoney(challenger.id, betAmount * 2);

            resultEmbed

                .addField("🎉 Victory!", `One of the dice rolled a 1. You win **⏣ ${betAmount * 2}**!`)

                .setColor("GREEN");

        } else {

            // Player loses

            await client.eco.transfer(challenger.id, 'eco_bank', betAmount);

            resultEmbed

                .addField("💸 You Lost", `Neither die rolled a 1. You lost **⏣ ${betAmount}**.`)

                .setColor("RED");

        }

        return sentMessage.edit({ embed: resultEmbed });

    };

    // Ask the user if they want to roll the dice

    confirmRoll();

};

exports.help = {

    name: "snakeeyes",

    aliases: ["se"],

    usage: "snakeeyes <bet_amount>"

};