CorwinDev / Discord-Bot

Discord Bot with over 400 commands and made for large servers
MIT License
656 stars 599 forks source link

No problems Just updated a command #153

Open BallisticOK opened 1 year ago

BallisticOK commented 1 year ago

Greetings everyone,

Upon reviewing the Lovemeter command, I have taken the liberty to enhance its functionality and make it more sophisticated. I am pleased to share with you the updated code, which you are free to utilize at your discretion.

Kindly note that implementing the updated code is a simple process. All you need to do is copy and paste the code into the "lovemeter.js" file located in the "src/commands/fun" directory. This will override the existing code. Once this is done, you will need to restart the bot, and the updated Lovemeter command will be fully functional.

module.exports = async (client, interaction, args) => {
    const user1 = interaction.options.getUser('user1');
    const user2 = interaction.options.getUser('user2');

   if (user1.id === user2.id) {
        return client.embed({
            title: '❌ Invalid command usage',
            desc: 'Please specify two different users.',
            type: 'editreply'
        }, interaction);
    }

    const result = Math.ceil(Math.random() * 100);
    const shipLevel = Math.ceil(result / 10);

    const shipBar = `${'❤️'.repeat(shipLevel)}${'🖤'.repeat(10 - shipLevel)}`;

    client.embed({
        title: `${client.emotes.normal.heart}・Love meter`,
        desc: `**${user1.username}** ❤️ **${user2.username}**`,
        fields: [
            {
                name: 'Compatibility level',
                value: `${result}%\n${shipBar}`,
                inline: false
            }
        ],
        type: 'editreply'
    }, interaction);
}
Ruben-Schadron commented 1 year ago

you can leave

if (!user1 || !user2) {
        return client.embed({
            title: '❌ Invalid command usage',
            desc: 'Please specify two users to ship.',
            type: 'editreply'
        }, interaction);
    }

away. This because the options are required when you register the commands

BallisticOK commented 1 year ago

Thank you for bringing this to my attention.