From 74159ac1daf7f7f5a0e0c1684c85807c0fbc1310 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Susa=C3=B1a?= Date: Sun, 17 Mar 2024 22:31:56 -0400 Subject: [PATCH] fix: shorters --- src/structures/GuildEmoji.ts | 16 ++++++++-------- src/structures/GuildMember.ts | 4 ++-- src/structures/Interaction.ts | 2 +- src/structures/Message.ts | 8 ++++---- src/structures/Webhook.ts | 7 +++---- src/structures/channels.ts | 21 ++++++++++----------- 6 files changed, 28 insertions(+), 30 deletions(-) diff --git a/src/structures/GuildEmoji.ts b/src/structures/GuildEmoji.ts index 773db08..70924b5 100644 --- a/src/structures/GuildEmoji.ts +++ b/src/structures/GuildEmoji.ts @@ -2,7 +2,7 @@ import type { BaseImageURLOptions } from '../api'; import type { BaseClient } from '../client/base'; import type { APIEmoji, - GuildShorter, + EmojiShorter, MethodContext, ObjectToLower, RESTPatchAPIChannelJSONBody, @@ -27,15 +27,15 @@ export class GuildEmoji extends DiscordBase { } edit(body: RESTPatchAPIChannelJSONBody, reason?: string) { - return this.client.guilds.emojis.edit(this.guildId, this.id, body, reason); + return this.client.emojis.edit(this.guildId, this.id, body, reason); } delete(reason?: string) { - return this.client.guilds.emojis.delete(this.guildId, this.id, reason); + return this.client.emojis.delete(this.guildId, this.id, reason); } fetch(force = false) { - return this.client.guilds.emojis.fetch(this.guildId, this.id, force); + return this.client.emojis.fetch(this.guildId, this.id, force); } url(options?: BaseImageURLOptions) { @@ -57,10 +57,10 @@ export class GuildEmoji extends DiscordBase { static methods({ client, guildId }: MethodContext<{ guildId: string }>) { return { edit: (emojiId: string, body: RESTPatchAPIGuildEmojiJSONBody, reason?: string) => - client.guilds.emojis.edit(guildId, emojiId, body, reason), - create: (body: Parameters[1]) => client.guilds.emojis.create(guildId, body), - fetch: (emojiId: string, force = false) => client.guilds.emojis.fetch(guildId, emojiId, force), - list: (force = false) => client.guilds.emojis.list(guildId, force), + client.emojis.edit(guildId, emojiId, body, reason), + create: (body: Parameters[1]) => client.emojis.create(guildId, body), + fetch: (emojiId: string, force = false) => client.emojis.fetch(guildId, emojiId, force), + list: (force = false) => client.emojis.list(guildId, force), }; } } diff --git a/src/structures/GuildMember.ts b/src/structures/GuildMember.ts index fa820f3..059753e 100644 --- a/src/structures/GuildMember.ts +++ b/src/structures/GuildMember.ts @@ -96,8 +96,8 @@ export class BaseGuildMember extends DiscordBase { get roles() { return { values: Object.freeze(this._roles), - add: (id: string) => this.client.members.roles.add(this.guildId, this.id, id), - remove: (id: string) => this.client.members.roles.remove(this.guildId, this.id, id), + add: (id: string) => this.client.members.addRole(this.guildId, this.id, id), + remove: (id: string) => this.client.members.removeRole(this.guildId, this.id, id), permissions: async () => new PermissionsBitField( ((await this.cache.roles?.bulk(this.roles.values as string[])) ?? []) diff --git a/src/structures/Interaction.ts b/src/structures/Interaction.ts index bacf7b7..127b7f6 100644 --- a/src/structures/Interaction.ts +++ b/src/structures/Interaction.ts @@ -326,7 +326,7 @@ export class Interaction< Type extends APIInteraction = APIInteraction, > extends BaseInteraction { fetchMessage(messageId: string) { - return this.client.webhooks.messages.fetch(this.applicationId, this.token, messageId); + return this.client.webhooks.fetchMessage(this.applicationId, this.token, messageId); } fetchResponse() { diff --git a/src/structures/Message.ts b/src/structures/Message.ts index e3265ed..dcea30e 100644 --- a/src/structures/Message.ts +++ b/src/structures/Message.ts @@ -64,7 +64,7 @@ export class BaseMessage extends DiscordBase { } react(emoji: EmojiResolvable) { - return this.client.messages.reactions.add(this.id, this.channelId, emoji); + return this.client.reactions.add(this.id, this.channelId, emoji); } private patch(data: MessageData) { @@ -170,14 +170,14 @@ export class WebhookMessage extends BaseMessage { } edit(body: EditMessageWebhook) { - return this.client.webhooks.messages.edit(this.webhookId, this.webhookToken, { ...body, messageId: this.id }); + return this.client.webhooks.editMessage(this.webhookId, this.webhookToken, { ...body, messageId: this.id }); } write(body: WriteMessageWebhook) { - return this.client.webhooks.messages.write(this.webhookId, this.webhookToken, body); + return this.client.webhooks.writeMessage(this.webhookId, this.webhookToken, body); } delete(reason?: string) { - return this.client.webhooks.messages.delete(this.webhookId, this.webhookToken, this.id, reason); + return this.client.webhooks.deleteMessage(this.webhookId, this.webhookToken, this.id, reason); } } diff --git a/src/structures/Webhook.ts b/src/structures/Webhook.ts index 54f1c07..44e7ea8 100644 --- a/src/structures/Webhook.ts +++ b/src/structures/Webhook.ts @@ -71,11 +71,10 @@ export class Webhook extends DiscordBase { static messages({ client, webhookId, webhookToken }: MethodContext<{ webhookId: string; webhookToken: string }>) { return { write: (payload: MessageWebhookMethodWriteParams) => - client.webhooks.messages.write(webhookId, webhookToken, payload), - edit: (payload: MessageWebhookMethodEditParams) => - client.webhooks.messages.edit(webhookId, webhookToken, payload), + client.webhooks.writeMessage(webhookId, webhookToken, payload), + edit: (payload: MessageWebhookMethodEditParams) => client.webhooks.editMessage(webhookId, webhookToken, payload), delete: (messageId: string, reason?: string) => - client.webhooks.messages.delete(webhookId, webhookToken, messageId, reason), + client.webhooks.deleteMessage(webhookId, webhookToken, messageId, reason), }; } diff --git a/src/structures/channels.ts b/src/structures/channels.ts index c4dd4c7..fd92bff 100644 --- a/src/structures/channels.ts +++ b/src/structures/channels.ts @@ -176,15 +176,15 @@ export class BaseGuildChannel extends BaseChannel { }; memberPermissions(member: GuildMember, checkAdmin = true) { - return this.client.channels.overwrites.memberPermissions(this.id, member, checkAdmin); + return this.client.channels.memberPermissions(this.id, member, checkAdmin); } rolePermissions(role: GuildRole, checkAdmin = true) { - return this.client.channels.overwrites.rolePermissions(this.id, role, checkAdmin); + return this.client.channels.rolePermissions(this.id, role, checkAdmin); } overwritesFor(member: GuildMember) { - return this.client.channels.overwrites.overwritesFor(this.id, member); + return this.client.channels.overwritesFor(this.id, member); } guild(force = false) { @@ -233,21 +233,20 @@ export class MessagesMethods extends DiscordBase { static reactions(ctx: MethodContext<{ channelId: string }>) { return { - add: (messageId: string, emoji: EmojiResolvable) => - ctx.client.messages.reactions.add(messageId, ctx.channelId, emoji), + add: (messageId: string, emoji: EmojiResolvable) => ctx.client.reactions.add(messageId, ctx.channelId, emoji), delete: (messageId: string, emoji: EmojiResolvable, userId = '@me') => - ctx.client.messages.reactions.delete(messageId, ctx.channelId, emoji, userId), + ctx.client.reactions.delete(messageId, ctx.channelId, emoji, userId), fetch: (messageId: string, emoji: EmojiResolvable, query?: RESTGetAPIChannelMessageReactionUsersQuery) => - ctx.client.messages.reactions.fetch(messageId, ctx.channelId, emoji, query), + ctx.client.reactions.fetch(messageId, ctx.channelId, emoji, query), purge: (messageId: string, emoji?: EmojiResolvable) => - ctx.client.messages.reactions.purge(messageId, ctx.channelId, emoji), + ctx.client.reactions.purge(messageId, ctx.channelId, emoji), }; } static pins(ctx: MethodContext<{ channelId: string }>) { return { - fetch: () => ctx.client.channels.pins.fetch(ctx.channelId), - set: (messageId: string, reason?: string) => ctx.client.channels.pins.set(messageId, ctx.channelId, reason), - delete: (messageId: string, reason?: string) => ctx.client.channels.pins.delete(messageId, ctx.channelId, reason), + fetch: () => ctx.client.channels.pins(ctx.channelId), + set: (messageId: string, reason?: string) => ctx.client.channels.setPin(messageId, ctx.channelId, reason), + delete: (messageId: string, reason?: string) => ctx.client.channels.deletePin(messageId, ctx.channelId, reason), }; }