如何为discord.js创建quote命令

时间:2020-11-07 12:45:52

标签: discord.js

我一直在尝试为不和谐的bot发出quote命令,但似乎无法完全正确,我一直在查找源代码,但似乎仍然无法正常工作。我是discord.js的新手,但我大部分时间都对它理解,对不起您的混乱。

    const replies = ["quote1","quote2","quote3","quote4"];

    const reply = Math.floor(Math.random() * replies.length);

    const filter = m => m.author.id === message.author.id;

    const dmessage = message.channel.send(replies[reply]).then(async (start) => {
        if (dmessage === replies[0]){
        message.channel.awaitMessages(filter,
            {max: 1, time: 30000, errors: ['time']}).then(async (collected) => {
                if (collected.first().content.toLowerCase() == 'answer') {
                    message.reply('Correct!');
                } else message.reply('Wrong!');
            }).catch(() => {
                message.reply("No answer! Canceled.");
            });
        
    }})`

0 个答案:

没有答案