【发布时间】:2021-02-16 00:34:21
【问题描述】:
如果(命令 === clear){
常量数量 = arg.join(" ");
if(!amount) return message.reply('please provide an amount of messages for me to delete')
if(amount > 100) return message.reply(`you cannot clear more than 100 messages at once`)
if(amount < 1) return message.reply(`you need to delete at least one message`)
await message.channel.messages.fetch({limit: amount}).then(messages => {
message.channel.bulkDelete(messages
)});
【问题讨论】:
-
您必须在函数中缺少 'async' 关键字。可以在没有 await 的情况下编写 async 关键字,但不允许反向。只需在函数定义中添加异步,这应该可以解决。 const handleSubmit = async (e) => { /*其余代码*/}
标签: async-await discord.js pls