lundi 30 octobre 2023

How do I code a Discord Bot that pulls an option out of a list, and replies it? I have tried some other options

I tried to code a Discord Bot that pulls a joke out of a list. I believe I did it wrong. Does anyone have a fix? My bot won't respond to $joke. My other simple text commands are fine.

const randomJokelist = ['A','B','C']
const random = Math.floor(Math.random() * randomJokelist.length);

client.on('messageCreate', (message) => {
    const randomJokelist = ['A','B','C']
    const random = Math.floor(Math.random() * randomJokelist.length);
    if (message.content === '$joke') {
        message.reply(random, randomJokelist[random]);
    }
});

I tried to code a Discord Bot using client functions and a random number drawer in JS. The bot doesn't respond.




Aucun commentaire:

Enregistrer un commentaire