mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 08:33:30 +01:00
committed by
Schuyler Cebulskie
parent
529d7207da
commit
15d7f8e2fe
@@ -504,6 +504,27 @@ class Guild {
|
||||
return create.then(role => role.edit(data));
|
||||
}
|
||||
|
||||
/**
|
||||
* Prunes members from the guild based on how long they have been inactive.
|
||||
* @param {number} days Number of days of inactivity required to kick
|
||||
* @param {boolean} [dry=false] If true, will return number of users that will be kicked, without actually doing it
|
||||
* @returns {Promise<number>} The number of members that were/will be kicked
|
||||
* @example
|
||||
* // see how many members will be pruned
|
||||
* guild.prune(12, true)
|
||||
* .then(pruned => console.log(`This will prune ${pruned} people!`);
|
||||
* .catch(console.error);
|
||||
* @example
|
||||
* // actually prune the members
|
||||
* guild.prune(12)
|
||||
* .then(pruned => console.log(`I just pruned ${pruned} people!`);
|
||||
* .catch(console.error);
|
||||
*/
|
||||
prune(days, dry = false) {
|
||||
if (typeof days !== 'number') throw new TypeError('Days must be a number.');
|
||||
return this.client.rest.methods.pruneGuildMembers(this, days, dry);
|
||||
}
|
||||
|
||||
/**
|
||||
* Causes the Client to leave the guild.
|
||||
* @returns {Promise<Guild>}
|
||||
|
||||
Reference in New Issue
Block a user