Discord.js rock paper scissors command not doing anything, even though there are no apparent errors

I’m new to coding, so keep that in mind haha. So basically, I’m trying to create a rock/paper/scissors command for a Discord bot in discord.js. There are no errors, however, when I send the command in Discord, nothing happens. I’ve successfully done other commands using this same bot and command handler, so I don’t know what the issue is. Here’s my command handler:

client.on('message', message =>{
    if(!message.content.startsWith(prefix) || message.author.bot)return;

    const args = message.content.slice(prefix.length).split(/ +/);
    const command = args.shift().toLowerCase();

 if(command === 'rps'){
        client.commands.get('rps').execute(message, args, Discord);
    }

So yeah. Here’s the code for my the rps command:

const discord = require('discord.js')
module.exports = {
    name: "rps",
    description: "play a game of rock, paper and scissors",
    run: async(client, message, args) => {
        let embed = new discord.MessageEmbed()
        .setTitle("RPS")
        .setDescription("React with your choice")
        .setTimestamp()
        let msg = await message.channel.send(embed)
        await msg.react("🗻")
        await msg.react("✂")
        await msg.react("📰")

        const filter = (reaction, user) => {
            return ['🗻', '✂', '📰'].includes(reaction.emoji.name) && user.id === message.author.id;
        }

        const choices = ['🗻', '✂', '📰']
        const me = choices[Math.floor(Math.random() * choices.length)]
        msg.awaitReactions(filter, {max:1, time: 60000, error: ["time"]}).then(
            async(collected) => {
                const reaction = collected.first()
                let result = new discord.MessageEmbed()
                .setTitle("RESULT")
                .addField("Your choice", `${reaction.emoji.name}`)
                .addField("My choice", `${me}`)
            await msg.edit(result)
                if ((me === "🗻" && reaction.emoji.name === "✂") ||
                (me === "📰" && reaction.emoji.name === "🗻") ||
                (me === "✂" && reaction.emoji.name === "📰")) {
                    message.reply("You lost!");
            } else if (me === reaction.emoji.name) {
                return message.reply("It's a tie!");
            } else {
                return message.reply("You won!");
            }
        })
        .catch(collected => {
                message.reply('You ran out of time- cancelling game.');
            })
}
}

So there it is. There are no error messages, but when I try and run the command, the bot doesn’t react. Can someone please help me with this? Thank you so much.

Edit: I didn’t include this in the code because im dumb, but I did specify the prefix, so that’s not the issue.

Leave a Comment