Discord JS member.ban 不删除消息
Discord JS member.ban not deleting messages
我最近一直在为机器人帐户设置一个 member.ban,比如邀请链接帐户,但每次我 运行 member.ban,它都会禁止它们但不会删除任何消息(加入消息或发送的任何消息)有没有办法增加删除消息历史记录的时间(例如手动禁止?)
// ./events/guildMemberAdd.js
if (member.user.username.includes("discord.gg")) {
member.ban("Account being a bot.")
.then(() => console.log(`Banned ${member.displayName}, ${m}`))
.catch(console.error);
}
ban 方法中的参数(如果它是整数)确定您要删除多少天的消息(最多 7 天),
member.ban(7) // will delete messages in the last 7 days by that user.
如果是字符串,请添加禁止的原因。如果您想要两者,则必须传递具有属性 days
和 reason
.
的对象
member.ban({days:7,reason:"Trolling!"}) // will delete messages in last 7 days and add reason
我最近一直在为机器人帐户设置一个 member.ban,比如邀请链接帐户,但每次我 运行 member.ban,它都会禁止它们但不会删除任何消息(加入消息或发送的任何消息)有没有办法增加删除消息历史记录的时间(例如手动禁止?)
// ./events/guildMemberAdd.js
if (member.user.username.includes("discord.gg")) {
member.ban("Account being a bot.")
.then(() => console.log(`Banned ${member.displayName}, ${m}`))
.catch(console.error);
}
ban 方法中的参数(如果它是整数)确定您要删除多少天的消息(最多 7 天),
member.ban(7) // will delete messages in the last 7 days by that user.
如果是字符串,请添加禁止的原因。如果您想要两者,则必须传递具有属性 days
和 reason
.
member.ban({days:7,reason:"Trolling!"}) // will delete messages in last 7 days and add reason