Skip to content

Commit

Permalink
types(*): create mention types (#6003)
Browse files Browse the repository at this point in the history
  • Loading branch information
DTrombett authored Jul 3, 2021
1 parent 1242c54 commit 0dc5dd5
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ declare module 'discord.js' {
public fetch(force?: boolean): Promise<Channel>;
public isText(): this is TextChannel | DMChannel | NewsChannel | ThreadChannel;
public isThread(): this is ThreadChannel;
public toString(): string;
public toString(): ChannelMention;
}

export class Client extends BaseClient {
Expand Down Expand Up @@ -1103,7 +1103,7 @@ declare module 'discord.js' {
public permissionsIn(channel: GuildChannelResolvable): Readonly<Permissions>;
public setNickname(nickname: string | null, reason?: string): Promise<GuildMember>;
public toJSON(): unknown;
public toString(): string;
public toString(): MemberMention;
public valueOf(): string;
}

Expand Down Expand Up @@ -1757,7 +1757,7 @@ declare module 'discord.js' {
public setPermissions(permissions: PermissionResolvable, reason?: string): Promise<Role>;
public setPosition(position: number, options?: SetRolePositionOptions): Promise<Role>;
public toJSON(): unknown;
public toString(): string;
public toString(): RoleMention;

public static comparePositions(role1: Role, role2: Role): number;
}
Expand Down Expand Up @@ -2052,7 +2052,7 @@ declare module 'discord.js' {
public equals(user: User): boolean;
public fetch(force?: boolean): Promise<User>;
public fetchFlags(force?: boolean): Promise<UserFlags>;
public toString(): string;
public toString(): UserMention;
public typingDurationIn(channel: ChannelResolvable): number;
public typingIn(channel: ChannelResolvable): boolean;
public typingSinceIn(channel: ChannelResolvable): Date;
Expand Down Expand Up @@ -3034,6 +3034,8 @@ declare module 'discord.js' {
around?: Snowflake;
}

type ChannelMention = `<#${Snowflake}>`;

interface ChannelPosition {
channel: ChannelResolvable;
lockPermissions?: boolean;
Expand Down Expand Up @@ -3715,6 +3717,8 @@ declare module 'discord.js' {
stack: string;
}

type MemberMention = UserMention | `<@!${Snowflake}>`;

type MembershipState = keyof typeof MembershipStates;

type MessageActionRowComponent = MessageButton | MessageSelectMenu;
Expand Down Expand Up @@ -4214,6 +4218,8 @@ declare module 'discord.js' {
mentionable?: boolean;
}

type RoleMention = '@everyone' | `<@&${Snowflake}>`;

interface RolePosition {
role: RoleResolvable;
position: number;
Expand Down Expand Up @@ -4343,6 +4349,8 @@ declare module 'discord.js' {
| 'EARLY_VERIFIED_BOT_DEVELOPER'
| 'DISCORD_CERTIFIED_MODERATOR';

type UserMention = `<@${Snowflake}>`;

type UserResolvable = User | Snowflake | Message | GuildMember | ThreadMember;

interface Vanity {
Expand Down

0 comments on commit 0dc5dd5

Please sign in to comment.