Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(typings): return types for 'Webhook(Client)#send()' #4876

Merged
merged 6 commits into from
Jan 22, 2021
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 105 additions & 6 deletions typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2097,18 +2097,21 @@ declare module 'discord.js' {
edit(options: WebhookEditData): Promise<Webhook>;
send(
content: APIMessageContentResolvable | (WebhookMessageOptions & { split?: false }) | MessageAdditions,
): Promise<Message>;
send(options: WebhookMessageOptions & { split: true | SplitOptions }): Promise<Message[]>;
send(options: WebhookMessageOptions | APIMessage): Promise<Message | Message[]>;
): Promise<Message | APIRawMessage>;
send(options: WebhookMessageOptions & { split: true | SplitOptions }): Promise<(Message | APIRawMessage)[]>;
send(options: WebhookMessageOptions | APIMessage): Promise<Message | APIRawMessage | (Message | APIRawMessage)[]>;
send(
content: StringResolvable,
options: (WebhookMessageOptions & { split?: false }) | MessageAdditions,
): Promise<Message>;
): Promise<Message | APIRawMessage>;
send(
content: StringResolvable,
options: WebhookMessageOptions & { split: true | SplitOptions },
): Promise<Message[]>;
send(content: StringResolvable, options: WebhookMessageOptions): Promise<Message | Message[]>;
): Promise<(Message | APIRawMessage)[]>;
send(
content: StringResolvable,
options: WebhookMessageOptions,
): Promise<Message | APIRawMessage | (Message | APIRawMessage)[]>;
sendSlackMessage(body: object): Promise<boolean>;
}

Expand Down Expand Up @@ -2184,6 +2187,102 @@ declare module 'discord.js' {

type APIMessageContentResolvable = string | number | boolean | bigint | symbol | readonly StringResolvable[];

interface APIRawMessage {
id: Snowflake;
type: number;
content: string;
channel_id: Snowflake;
author: {
bot: boolean;
izexi marked this conversation as resolved.
Show resolved Hide resolved
id: Snowflake;
username: string;
avatar: string | null;
discriminator: string;
};
attachments: {
id: Snowflake;
filename: string;
size: number;
url: string;
proxy_url: string;
height: number | null;
width: number | null;
}[];
embeds: {
title?: string;
type?: 'rich' | 'image' | 'video' | 'gifv' | 'article' | 'link';
description?: string;
url?: string;
timestamp?: string;
color?: number;
footer?: {
text: string;
icon_url?: string;
proxy_icon_url?: string;
};
image?: {
url?: string;
proxy_url?: string;
height?: number;
width?: number;
};
thumbnail?: {
url?: string;
proxy_url?: string;
height?: number;
width?: number;
};
video?: {
url?: string;
height?: number;
width?: number;
};
provider?: { name?: string; url?: string };
author?: {
name?: string;
url?: string;
icon_url?: string;
proxy_icon_url?: string;
};
fields?: {
name: string;
value: string;
inline?: boolean;
}[];
}[];
mentions: {
id: Snowflake;
username: string;
discriminator: string;
avatar: string | null;
bot?: boolean;
system?: boolean;
mfa_enabled?: boolean;
locale?: string;
verified?: boolean;
email?: string | null;
flags?: number;
premium_type?: number;
izexi marked this conversation as resolved.
Show resolved Hide resolved
public_flags?: number;
member?: {
nick: string | null;
roles: Snowflake[];
joined_at: string;
premium_since?: string | null;
deaf: boolean;
mute: boolean;
};
}[];
mention_roles: Snowflake[];
pinned: boolean;
mention_everyone: boolean;
tts: boolean;
timestamp: string;
edited_timestamp: string | null;
flags: number;
webhook_id: Snowflake;
}

interface ApplicationAsset {
name: string;
id: Snowflake;
Expand Down