This commit is contained in:
Skillz
2020-07-14 18:22:39 -04:00
parent 6e9e6c1189
commit cfac630734
2 changed files with 9 additions and 6 deletions

View File

@@ -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 */

View File

@@ -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 {