Fix return types and make it much better
This commit is contained in:
parent
617e3b6204
commit
cc657cc4d8
1 changed files with 20 additions and 20 deletions
|
@ -363,13 +363,13 @@ export class Guild extends Base {
|
||||||
return result === undefined ? this : result
|
return result === undefined ? this : result
|
||||||
}
|
}
|
||||||
|
|
||||||
async getPruneCount(
|
async getPruneCount(options?: {
|
||||||
days?: number,
|
days?: number
|
||||||
includeRoles?: Array<Role | string>
|
includeRoles?: Array<Role | string>
|
||||||
): Promise<number> {
|
}): Promise<number> {
|
||||||
const query: GuildGetPruneCountPayload = {
|
const query: GuildGetPruneCountPayload = {
|
||||||
days: days,
|
days: options?.days,
|
||||||
include_roles: includeRoles
|
include_roles: options?.includeRoles
|
||||||
?.map((role) => (role instanceof Role ? role.id : role))
|
?.map((role) => (role instanceof Role ? role.id : role))
|
||||||
.join(',')
|
.join(',')
|
||||||
}
|
}
|
||||||
|
@ -386,25 +386,25 @@ export class Guild extends Base {
|
||||||
return result.pruned as number
|
return result.pruned as number
|
||||||
}
|
}
|
||||||
|
|
||||||
async prune(
|
async prune(options?: {
|
||||||
days?: number,
|
days?: number
|
||||||
computePruneCount?: false,
|
computePruneCount: true | undefined
|
||||||
includeRoles?: Array<Role | string>
|
includeRoles?: Array<Role | string>
|
||||||
): Promise<null>
|
}): Promise<number>
|
||||||
async prune(
|
async prune(options?: {
|
||||||
days?: number,
|
days?: number
|
||||||
computePruneCount?: true | undefined,
|
computePruneCount: false
|
||||||
includeRoles?: Array<Role | string>
|
includeRoles?: Array<Role | string>
|
||||||
): Promise<number>
|
}): Promise<null>
|
||||||
async prune(
|
async prune(options?: {
|
||||||
days?: number,
|
days?: number
|
||||||
computePruneCount?: boolean,
|
computePruneCount?: boolean | undefined
|
||||||
includeRoles?: Array<Role | string>
|
includeRoles?: Array<Role | string>
|
||||||
): Promise<number | null> {
|
}): Promise<number | null> {
|
||||||
const body: GuildBeginPrunePayload = {
|
const body: GuildBeginPrunePayload = {
|
||||||
days: days,
|
days: options?.days,
|
||||||
compute_prune_count: computePruneCount,
|
compute_prune_count: options?.computePruneCount,
|
||||||
include_roles: includeRoles?.map((role) =>
|
include_roles: options?.includeRoles?.map((role) =>
|
||||||
role instanceof Role ? role.id : role
|
role instanceof Role ? role.id : role
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue