DISCORD.JS 创建一个小的等待反应函数

时间:2021-03-07 21:25:40

标签: javascript node.js discord.js

如何创建一个类似于下面的函数,但使用 awaitReactions

async awaitReply(message, ask, limit = 60) {
    const filter = m => m.author.id === message.author.id
    const question = await message.channel.send(ask)
    try {
      const answer = await message.channel.awaitMessages(filter, { max: 1, time: limit * 1000 })
      question.delete()
      answer.first().delete()
      return answer.first().content
    } catch (e) {
      return console.log(e)
    }
  }

我也试过了,没用

async awaitReaction(message, ask, emojis = ["✅", "⛔"], limit = 60) {
    const filter = (reaction, user) => {
      return emojis.includes(reaction.emoji.name) && user.id === message.author.id
    }
    const question = await message.channel.send(ask)
    for (let emoji of emojis) {
      await question.react(emoji)
    }
    const reactios = await question.awaitReactions(filter, { max: 1, time: limit * 1000, erros: ["time"] })
    question.delete()
    return reactions.first().emoji.name
  }```

0 个答案:

没有答案