feat(WebhookClient): allow creation of clients via URLs (#6192)

This commit is contained in:
Justin
2021-07-29 18:48:43 +08:00
committed by GitHub
parent 42a0313034
commit e000af5c98
4 changed files with 39 additions and 6 deletions

13
typings/index.d.ts vendored
View File

@@ -1900,7 +1900,7 @@ export class Webhook extends WebhookMixin() {
}
export class WebhookClient extends WebhookMixin(BaseClient) {
public constructor(id: Snowflake, token: string, options?: WebhookClientOptions);
public constructor(data: WebhookClientData, options?: WebhookClientOptions);
public client: this;
public options: WebhookClientOptions;
public token: string;
@@ -4350,6 +4350,17 @@ export type VerificationLevel = keyof typeof VerificationLevels;
export type VoiceBasedChannelTypes = 'GUILD_VOICE' | 'GUILD_STAGE_VOICE';
export type WebhookClientData = WebhookClientDataIdWithToken | WebhookClientDataURL;
export interface WebhookClientDataIdWithToken {
id: Snowflake;
token: string;
}
export interface WebhookClientDataURL {
url: string;
}
export type WebhookClientOptions = Pick<
ClientOptions,
'allowedMentions' | 'restTimeOffset' | 'restRequestTimeout' | 'retryLimit' | 'http'