Skip to content
This repository has been archived by the owner on Aug 28, 2020. It is now read-only.

Fix RichMenu#run() return value type #91

Merged
merged 4 commits into from
Nov 21, 2017
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 4 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ module.exports = {
* @external DiscordJSConfig
* @see {@link https://discord.js.org/#/docs/main/master/typedef/ClientOptions}
*/
/**
* @external ClientApplication
* @see {@link https://discord.js.org/#/docs/main/master/class/ClientApplication}
*/
/**
* @external Collection
* @see {@link https://discord.js.org/#/docs/main/master/class/Collection}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ class KlasaClient extends Discord.Client {
/**
* The application info cached from the discord api
* @since 0.0.1
* @type {object}
* @type {external:ClientApplication}
*/
this.application = null;

Expand Down
50 changes: 24 additions & 26 deletions typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ declare module 'klasa' {

import {
Client,
ClientApplication,
ClientOptions,
Collection,
Snowflake,
Expand All @@ -23,14 +24,11 @@ declare module 'klasa' {
VoiceChannel as DiscordVoiceChannel,
DMChannel as DiscordDMChannel,
GroupDMChannel as DiscordGroupDMChannel,
OAuth2Application,
MessageOptions,
ReactionCollector,

StringResolvable,
Attachment,
RichEmbed,
RichEmbedOptions,
MessageAttachment,
BufferResolvable
} from 'discord.js';

Expand Down Expand Up @@ -66,7 +64,7 @@ declare module 'klasa' {
util: Util;
};
public settings: StringMappedType<SettingGateway<string>>;
public application: OAuth2Application;
public application: ClientApplication;

public readonly invite: string;
public readonly owner: ExtendedUser;
Expand Down Expand Up @@ -201,9 +199,9 @@ declare module 'klasa' {
}

export class RichDisplay {
public constructor(embed: RichEmbed);
public embedTemplate: RichEmbed;
public pages: RichEmbed[];
public constructor(embed: MessageEmbed);
public embedTemplate: MessageEmbed;
public pages: MessageEmbed[];
public infoPage?: MessageEmbed;
public emojis: RichDisplayEmojisObject;
public footered: boolean;
Expand All @@ -213,20 +211,20 @@ declare module 'klasa' {
public setInfoPage(embed: MessageEmbed): RichDisplay;
public run(msg: ExtendedMessage, options?: RichDisplayRunOptions): Promise<ReactionHandler>;
private _footer(): void;
private _determineEmojis(emojis: emoji[], stop: boolean): emoji[];
private _handlePageGeneration(cb: Function|RichEmbed): RichEmbed;
protected _determineEmojis(emojis: emoji[], stop: boolean, jump: boolean, firstLast: boolean): emoji[];
private _handlePageGeneration(cb: Function|MessageEmbed): MessageEmbed;
}

export class RichMenu extends RichDisplay {
public constructor(embed: RichEmbed);
public constructor(embed: MessageEmbed);
public emojis: RichMenuEmojisObject;
public paginated: boolean;
public options: MenuOption[];

public addOption(name: string, body: string, inline?: boolean): RichMenu;
public run(msg: ExtendedMessage, options?: RichMenuRunOptions): ReactionHandler;
public run(msg: ExtendedMessage, options?: RichMenuRunOptions): Promise<ReactionHandler>;

private _determineEmojis(emojis: emoji[], stop: boolean, jump: boolean, firstLast: boolean): emoji[];
protected _determineEmojis(emojis: emoji[], stop: boolean): emoji[];
private _paginate(): void;
}

Expand Down Expand Up @@ -1268,7 +1266,7 @@ declare module 'klasa' {
send(content?: StringResolvable, options?: MessageOptions): Promise<SentMessage>;
send(options: MessageOptions): Promise<SentMessage>;
sendCode(lang: string, content: StringResolvable, options?: MessageOptions): Promise<SentMessage>;
sendEmbed(embed: RichEmbed | RichEmbedOptions, content?: string, options?: MessageOptions): Promise<SentMessage>;
sendEmbed(embed: MessageEmbed, content?: string, options?: MessageOptions): Promise<SentMessage>;
sendMessage(content?: string, options?: MessageOptions): Promise<SentMessage>;
} & DiscordMessage;

Expand All @@ -1281,10 +1279,10 @@ declare module 'klasa' {
send(content?: StringResolvable, options?: MessageOptions): Promise<SentMessage>;
send(options: MessageOptions): Promise<SentMessage>;
sendCode(lang: string, content: StringResolvable, options?: MessageOptions): Promise<SentMessage>;
sendEmbed(embed: RichEmbed | RichEmbedOptions, content?: string, options?: MessageOptions): Promise<SentMessage>;
sendEmbed(embed: RichEmbed | RichEmbedOptions, options?: MessageOptions): Promise<ExtendedMessage>;
sendEmbed(embed: MessageEmbed, content?: string, options?: MessageOptions): Promise<SentMessage>;
sendEmbed(embed: MessageEmbed, options?: MessageOptions): Promise<ExtendedMessage>;
sendFile(attachment: BufferResolvable, name?: string, content?: StringResolvable, options?: MessageOptions): Promise<SentMessage>;
sendFiles(attachments: Attachment[], content: StringResolvable, options?: MessageOptions): Promise<SentMessage>;
sendFiles(attachments: MessageAttachment[], content: StringResolvable, options?: MessageOptions): Promise<SentMessage>;
sendMessage(content?: string, options?: MessageOptions): Promise<SentMessage>;
sendMessage(options: MessageOptions): Promise<SentMessage>;
} & DiscordUser;
Expand All @@ -1297,10 +1295,10 @@ declare module 'klasa' {
send(content?: StringResolvable, options?: MessageOptions): Promise<SentMessage>;
send(options: MessageOptions): Promise<SentMessage>;
sendCode(lang: string, content: StringResolvable, options?: MessageOptions): Promise<SentMessage>;
sendEmbed(embed: RichEmbed | RichEmbedOptions, content?: string, options?: MessageOptions): Promise<SentMessage>;
sendEmbed(embed: RichEmbed | RichEmbedOptions, options?: MessageOptions): Promise<ExtendedMessage>;
sendEmbed(embed: MessageEmbed, content?: string, options?: MessageOptions): Promise<SentMessage>;
sendEmbed(embed: MessageEmbed, options?: MessageOptions): Promise<ExtendedMessage>;
sendFile(attachment: BufferResolvable, name?: string, content?: StringResolvable, options?: MessageOptions): Promise<SentMessage>;
sendFiles(attachments: Attachment[], content: StringResolvable, options?: MessageOptions): Promise<SentMessage>;
sendFiles(attachments: MessageAttachment[], content: StringResolvable, options?: MessageOptions): Promise<SentMessage>;
sendMessage(content?: string, options?: MessageOptions): Promise<SentMessage>;
sendMessage(options: MessageOptions): Promise<SentMessage>;
} & DiscordTextChannel;
Expand All @@ -1316,10 +1314,10 @@ declare module 'klasa' {
send(content?: StringResolvable, options?: MessageOptions): Promise<SentMessage>;
send(options: MessageOptions): Promise<SentMessage>;
sendCode(lang: string, content: StringResolvable, options?: MessageOptions): Promise<SentMessage>;
sendEmbed(embed: RichEmbed | RichEmbedOptions, content?: string, options?: MessageOptions): Promise<SentMessage>;
sendEmbed(embed: RichEmbed | RichEmbedOptions, options?: MessageOptions): Promise<ExtendedMessage>;
sendEmbed(embed: MessageEmbed, content?: string, options?: MessageOptions): Promise<SentMessage>;
sendEmbed(embed: MessageEmbed, options?: MessageOptions): Promise<ExtendedMessage>;
sendFile(attachment: BufferResolvable, name?: string, content?: StringResolvable, options?: MessageOptions): Promise<SentMessage>;
sendFiles(attachments: Attachment[], content: StringResolvable, options?: MessageOptions): Promise<SentMessage>;
sendFiles(attachments: MessageAttachment[], content: StringResolvable, options?: MessageOptions): Promise<SentMessage>;
sendMessage(content?: string, options?: MessageOptions): Promise<SentMessage>;
sendMessage(options: MessageOptions): Promise<SentMessage>;
} & DiscordDMChannel;
Expand All @@ -1331,10 +1329,10 @@ declare module 'klasa' {
send(content?: StringResolvable, options?: MessageOptions): Promise<SentMessage>;
send(options: MessageOptions): Promise<SentMessage>;
sendCode(lang: string, content: StringResolvable, options?: MessageOptions): Promise<SentMessage>;
sendEmbed(embed: RichEmbed | RichEmbedOptions, content?: string, options?: MessageOptions): Promise<SentMessage>;
sendEmbed(embed: RichEmbed | RichEmbedOptions, options?: MessageOptions): Promise<ExtendedMessage>;
sendEmbed(embed: MessageEmbed, content?: string, options?: MessageOptions): Promise<SentMessage>;
sendEmbed(embed: MessageEmbed, options?: MessageOptions): Promise<ExtendedMessage>;
sendFile(attachment: BufferResolvable, name?: string, content?: StringResolvable, options?: MessageOptions): Promise<SentMessage>;
sendFiles(attachments: Attachment[], content: StringResolvable, options?: MessageOptions): Promise<SentMessage>;
sendFiles(attachments: MessageAttachment[], content: StringResolvable, options?: MessageOptions): Promise<SentMessage>;
sendMessage(content?: string, options?: MessageOptions): Promise<SentMessage>;
sendMessage(options: MessageOptions): Promise<SentMessage>;
} & DiscordGroupDMChannel;
Expand Down