mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-03 17:30:07 +00:00
support role ids for pruning
This commit is contained in:
@@ -21,12 +21,12 @@ import {
|
||||
PositionSwap,
|
||||
EditEmojisOptions,
|
||||
CreateRoleOptions,
|
||||
PrunePayload,
|
||||
FetchMembersOptions,
|
||||
GetAuditLogsOptions,
|
||||
EditIntegrationOptions,
|
||||
BanOptions,
|
||||
GuildEditOptions,
|
||||
PruneOptions,
|
||||
} from "../types/guild.ts";
|
||||
import { RoleData } from "../types/role.ts";
|
||||
import { createRole } from "../structures/role.ts";
|
||||
@@ -281,8 +281,8 @@ export function swapRoles(guildID: string, rolePositons: PositionSwap) {
|
||||
}
|
||||
|
||||
/** Check how many members would be removed from the server in a prune operation. Requires the KICK_MEMBERS permission */
|
||||
export async function getPruneCount(guildID: string, days: number) {
|
||||
if (days < 1) {
|
||||
export async function getPruneCount(guildID: string, options: PruneOptions) {
|
||||
if (options.days < 1) {
|
||||
throw new Error(Errors.PRUNE_MIN_DAYS);
|
||||
}
|
||||
if (
|
||||
@@ -290,11 +290,11 @@ export async function getPruneCount(guildID: string, days: number) {
|
||||
) {
|
||||
throw new Error(Errors.MISSING_KICK_MEMBERS);
|
||||
}
|
||||
const result = (await RequestManager.get(
|
||||
|
||||
RequestManager.get(
|
||||
endpoints.GUILD_PRUNE(guildID),
|
||||
{ days },
|
||||
)) as PrunePayload;
|
||||
return result.pruned;
|
||||
options,
|
||||
);
|
||||
}
|
||||
|
||||
/** Begin pruning all members in the given time period */
|
||||
|
||||
@@ -525,6 +525,13 @@ export interface PrunePayload {
|
||||
pruned: number;
|
||||
}
|
||||
|
||||
export interface PruneOptions {
|
||||
/** number of days to count prune for (1 or more). Defaults to 7 days. */
|
||||
days: number;
|
||||
/** comma-delimited array of role ids */
|
||||
include_roles: string;
|
||||
}
|
||||
|
||||
export interface Voice_State {
|
||||
/** the guild id this voice state is for */
|
||||
guild_id?: string;
|
||||
|
||||
Reference in New Issue
Block a user