fourth chunk

This commit is contained in:
ITOH
2021-11-14 18:24:14 +01:00
parent 1d63a0fc61
commit ddd73b20f5
22 changed files with 0 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
import type { GetGuildPruneCountQuery } from "../../types/guilds/get_guild_prune_count.ts";
import type { Bot } from "../../bot.ts";
/** Check how many members would be removed from the server in a prune operation. Requires the KICK_MEMBERS permission */
export async function getPruneCount(bot: Bot, guildId: bigint, options?: GetGuildPruneCountQuery) {
if (options?.days && options.days < 1) throw new Error(bot.constants.Errors.PRUNE_MIN_DAYS);
if (options?.days && options.days > 30) {
throw new Error(bot.constants.Errors.PRUNE_MAX_DAYS);
}
const result = await bot.rest.runMethod(
bot.rest,
"get",
bot.constants.endpoints.GUILD_PRUNE(guildId),
options
? {
days: options.days,
include_roles: options.includeRoles,
}
: {}
);
return result.pruned as number;
}