🦵Ban, unban & kick server members
How to manage the presence of server users.
How to do it?
To ban, unban or kick a server member, you either have to get the Member component that is linked to the user you'd like to perform an action on or you can also do it directly using the appropriate REST method.
Method 1
For example, if the member swears, you can directly get their Member component and ban them within the "messageCreate" event.
Make sure to enable the GUILD_MESSAGES and MESSAGE_CONTENT intents to detect messages that have been created as well as their content.
You can also get the component in other ways by using different events or get the Member component by using REST methods such as getMember or the cache-only method located in the Client.
and apply the ban accordingly using the Member#ban method, this is the same way for unban, and kick as you can use Member#unban and Member#kick
These are the methods you can use using the Member component:
Method 2
You can also use directly the REST method to ban, unban or kick a server member.
Ban
Unban
Last updated