types(structures): add return type for methods (#341)

This commit is contained in:
Ayyan
2021-01-03 19:12:13 +04:00
committed by GitHub
parent 22011b4227
commit 55f68a242d
5 changed files with 47 additions and 29 deletions
+16 -10
View File
@@ -231,19 +231,25 @@ export interface Message {
// METHODS
/** Delete the message */
delete(reason?: string, delayMilliseconds?: number): Promise<unknown>;
delete(
reason?: string,
delayMilliseconds?: number,
): ReturnType<typeof deleteMessageByID>;
/** Edit the message */
edit(content: string | MessageContent): Promise<Message>;
edit(content: string | MessageContent): ReturnType<typeof editMessage>;
/** Pins the message in the channel */
pin(): Promise<void>;
pin(): ReturnType<typeof pin>;
/** Add a reaction to the message */
addReaction(reaction: string): Promise<unknown>;
addReaction(reaction: string): ReturnType<typeof addReaction>;
/** Add multiple reactions to the message without or without order. */
addReactions(reactions: string[], ordered?: boolean): Promise<void>;
addReactions(
reactions: string[],
ordered?: boolean,
): ReturnType<typeof addReactions>;
/** Send a inline reply to this message */
reply(content: string | MessageContent): Promise<Message>;
reply(content: string | MessageContent): ReturnType<typeof sendMessage>;
/** Send a message to this channel where this message is */
send(content: string | MessageContent): Promise<Message>;
send(content: string | MessageContent): ReturnType<typeof sendMessage>;
/** Send a message to this channel and then delete it after a bit. By default it will delete after 10 seconds with no reason provided. */
alert(
content: string | MessageContent,
@@ -257,9 +263,9 @@ export interface Message {
reason?: string,
): Promise<unknown>;
/** Remove all reactions */
removeAllReactions(): Promise<unknown>;
removeAllReactions(): ReturnType<typeof removeAllReactions>;
/** Remove all reactions */
removeReactionEmoji(reaction: string): Promise<any>;
removeReactionEmoji(reaction: string): ReturnType<typeof removeReactionEmoji>;
/** Remove all reactions */
removeReaction(reaction: string): Promise<any>;
removeReaction(reaction: string): ReturnType<typeof removeReaction>;
}