diff --git a/handlers/guild.ts b/handlers/guild.ts index b82be3e50..b92bbf835 100644 --- a/handlers/guild.ts +++ b/handlers/guild.ts @@ -299,7 +299,7 @@ export async function getPruneCount(guildID: string, options: PruneOptions) { const result = await RequestManager.get( endpoints.GUILD_PRUNE(guildID), - options, + { ...options, include_roles: options.roles.join(",") }, ) as PrunePayload; return result.pruned; @@ -316,7 +316,10 @@ export function pruneMembers(guildID: string, options: PruneOptions) { throw new Error(Errors.MISSING_KICK_MEMBERS); } - RequestManager.post(endpoints.GUILD_PRUNE(guildID), options); + RequestManager.post( + endpoints.GUILD_PRUNE(guildID), + { ...options, include_roles: options.roles.join(",") }, + ); } export function fetchMembers(guild: Guild, options?: FetchMembersOptions) { @@ -440,7 +443,7 @@ export function ban(guildID: string, id: string, options: BanOptions) { throw new Error(Errors.MISSING_BAN_MEMBERS); } - return RequestManager.put(endpoints.GUILD_BAN(guildID, id), options); + return RequestManager.put(endpoints.GUILD_BAN(guildID, id), { ...options, delete_message_days: options.days }); } /** Remove the ban for a user. REquires BAN_MEMBERS permission */ diff --git a/types/guild.ts b/types/guild.ts index 7f0d93359..c139170e6 100644 --- a/types/guild.ts +++ b/types/guild.ts @@ -190,7 +190,7 @@ export interface Voice_Region { export interface BanOptions { /** number of days to delete messages for (0-7) */ - delete_message_days?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7; + days?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7; /** The reason for the ban. */ reason?: string; } @@ -528,8 +528,8 @@ export interface PrunePayload { 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; + /** Include members with these role ids */ + roles: string[]; } export interface Voice_State {