From dba2de730501adc66f309491590511fe45db567b Mon Sep 17 00:00:00 2001 From: Yuzu Date: Fri, 1 Jul 2022 14:47:51 -0500 Subject: [PATCH] fix: fmt --- structures/Message.ts | 10 +++++----- structures/TextChannel.ts | 22 ++++++++++++++++++---- util/Routes.ts | 21 +++++++++++++++------ 3 files changed, 38 insertions(+), 15 deletions(-) diff --git a/structures/Message.ts b/structures/Message.ts index 500185f..da8b573 100644 --- a/structures/Message.ts +++ b/structures/Message.ts @@ -184,7 +184,7 @@ export class Message implements Model { /** * alias for Message.addReaction - * */ + */ get react() { return this.addReaction; } @@ -213,13 +213,13 @@ export class Message implements Model { r, options.userId, ) - : Routes.CHANNEL_MESSAGE_REACTION_ME(this.channelId, this.id, r) + : Routes.CHANNEL_MESSAGE_REACTION_ME(this.channelId, this.id, r), ); } /** * Get users who reacted with this emoji - * */ + */ async fetchReactions(reaction: ReactionResolvable, options?: GetReactions): Promise { const r = typeof reaction === "string" ? reaction : `${reaction.name}:${reaction.id}`; @@ -238,7 +238,7 @@ export class Message implements Model { await this.session.rest.runMethod( this.session.rest, "DELETE", - Routes.CHANNEL_MESSAGE_REACTION(this.channelId, this.id, r) + Routes.CHANNEL_MESSAGE_REACTION(this.channelId, this.id, r), ); } @@ -246,7 +246,7 @@ export class Message implements Model { await this.session.rest.runMethod( this.session.rest, "DELETE", - Routes.CHANNEL_MESSAGE_REACTIONS(this.channelId, this.id) + Routes.CHANNEL_MESSAGE_REACTIONS(this.channelId, this.id), ); } diff --git a/structures/TextChannel.ts b/structures/TextChannel.ts index bbc9bd2..7bade2f 100644 --- a/structures/TextChannel.ts +++ b/structures/TextChannel.ts @@ -117,15 +117,25 @@ export class TextChannel extends GuildChannel { } async addReaction(messageId: Snowflake, reaction: ReactionResolvable) { - await Message.prototype.addReaction.call({ channelId: this.id, id: messageId, session: this.session }, reaction); + await Message.prototype.addReaction.call( + { channelId: this.id, id: messageId, session: this.session }, + reaction, + ); } async removeReaction(messageId: Snowflake, reaction: ReactionResolvable, options?: { userId: Snowflake }) { - await Message.prototype.removeReaction.call({ channelId: this.id, id: messageId, session: this.session }, reaction, options); + await Message.prototype.removeReaction.call( + { channelId: this.id, id: messageId, session: this.session }, + reaction, + options, + ); } async removeReactionEmoji(messageId: Snowflake, reaction: ReactionResolvable) { - await Message.prototype.removeReactionEmoji.call({ channelId: this.id, id: messageId, session: this.session }, reaction); + await Message.prototype.removeReactionEmoji.call( + { channelId: this.id, id: messageId, session: this.session }, + reaction, + ); } async nukeReactions(messageId: Snowflake) { @@ -133,7 +143,11 @@ export class TextChannel extends GuildChannel { } async fetchReactions(messageId: Snowflake, reaction: ReactionResolvable, options?: GetReactions) { - const users = await Message.prototype.fetchReactions.call({ channelId: this.id, id: messageId, session: this.session }, reaction, options); + const users = await Message.prototype.fetchReactions.call( + { channelId: this.id, id: messageId, session: this.session }, + reaction, + options, + ); return users; } diff --git a/util/Routes.ts b/util/Routes.ts index a53b7de..492d95b 100644 --- a/util/Routes.ts +++ b/util/Routes.ts @@ -178,12 +178,16 @@ export function CHANNEL_PINS(channelId: Snowflake) { return `/channels/${channelId}/pins`; } - export function CHANNEL_MESSAGE_REACTION_ME(channelId: Snowflake, messageId: Snowflake, emoji: string) { return `/channels/${channelId}/messages/${messageId}/reactions/${encodeURIComponent(emoji)}/@me`; } -export function CHANNEL_MESSAGE_REACTION_USER(channelId: Snowflake, messageId: Snowflake, emoji: string, userId: Snowflake) { +export function CHANNEL_MESSAGE_REACTION_USER( + channelId: Snowflake, + messageId: Snowflake, + emoji: string, + userId: Snowflake, +) { return `/channels/${channelId}/messages/${messageId}/reactions/${encodeURIComponent(emoji)}/${userId}`; } @@ -193,13 +197,18 @@ export function CHANNEL_MESSAGE_REACTIONS(channelId: Snowflake, messageId: Snowf /** * @link https://discord.com/developers/docs/resources/channel#get-reactions-query-string-params - * */ + */ export interface GetReactions { - after?: string; - limit?: number; + after?: string; + limit?: number; } -export function CHANNEL_MESSAGE_REACTION(channelId: Snowflake, messageId: Snowflake, emoji: string, options?: GetReactions) { +export function CHANNEL_MESSAGE_REACTION( + channelId: Snowflake, + messageId: Snowflake, + emoji: string, + options?: GetReactions, +) { let url = `/channels/${channelId}/messages/${messageId}/reactions/${encodeURIComponent(emoji)}?`; if (options?.after) url += `after=${options.after}`;