简体   繁体   中英

How to ban message author in discord.js

I'm making a function that has a 0.01 percent chance of banning you. But I can't seem to find a way to ban the author of the message. Here's what I have tried - message.author.ban()

message.author returns a user object - this is the information about an account not connected to the server it is in. To get the member object, you can do message.member - this gives you the member of the server and you can add roles, change nickname, kick, ban and more on this.
The correct way is message.member.ban() .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM