【发布时间】:2019-01-17 18:53:15
【问题描述】:
我希望创建一个命令来清除聊天内容,同时将所述聊天中清除的内容记录到只有 Mods/Admins 及更高版本才能看到的 mod-logs 频道。
我正在寻找类似于 Dyno BOT 的清除命令但没有 webapp 方面的东西。
我也在做我的代码:
if(command==="purge){
message.delete()// This deletes the command
// CODE GOES HERE
}else{
// This mentions the commanding person if they do not have the following permission MANAGE_MESSAGES
message.reply("Nice try, you do not have MANAGE_MESSAGES permission.")
}
}
【问题讨论】:
-
这可能对你有帮助:stackoverflow.com/a/46563610/9304377
-
这对清除有帮助,但不幸的是对日志记录没有帮助:(
-
使用 channel.fetchMessages,然后遍历返回的每条消息:
for const message of messages.values()。对于每条消息,使用 channel.send 将消息发送到任何日志通道,然后使用 message.delete() 删除每条消息。 -
此外,Discord.js 服务器对于任何 Discord.js 问题都非常有用。与 Stack Overflow 相比,您总是能得到即时响应:discordapp.com/invite/bRCvFy9
标签: javascript node.js discord discord.js