From 6c6334ee07a4d854dbdfa4141c4479eea56e3350 Mon Sep 17 00:00:00 2001 From: ayntee Date: Fri, 25 Dec 2020 20:36:23 +0400 Subject: [PATCH] fix: add Emoji#guild property back --- src/structures/emoji.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/structures/emoji.ts b/src/structures/emoji.ts index 0dfedda..3fae41a 100644 --- a/src/structures/emoji.ts +++ b/src/structures/emoji.ts @@ -2,6 +2,7 @@ import { Client } from '../models/client.ts' import { EmojiPayload } from '../types/emoji.ts' import { EMOJI } from '../types/endpoint.ts' import { Base } from './base.ts' +import { Guild } from "./guild.ts" import { User } from './user.ts' export class Emoji extends Base { @@ -9,6 +10,7 @@ export class Emoji extends Base { name: string roles?: string[] user?: User + guild?: Guild; requireColons?: boolean managed?: boolean animated?: boolean @@ -37,14 +39,16 @@ export class Emoji extends Base { } /** Modify the given emoji. Requires the MANAGE_EMOJIS permission. Returns the updated emoji object on success. Fires a Guild Emojis Update Gateway event. */ - async edit(guildID: string, data: ModifyGuildEmojiParams) { - const res = await this.client.rest.patch(EMOJI(guildID, this.id!)) + async edit(data: ModifyGuildEmojiParams) { + if (!this.guild) throw new Error("Guild is undefined"); + const res = await this.client.rest.patch(EMOJI(this.guild.id, this.id!), data) return new Emoji(this.client, res) } /** Delete the given emoji. Requires the MANAGE_EMOJIS permission. Returns `true` on success. Fires a Guild Emojis Update Gateway event. */ - async delete(guildID: string): Promise { - await this.client.rest.patch(EMOJI(guildID, this.id!)) + async delete(): Promise { + if (!this.guild) throw new Error("Guild is undefined"); + await this.client.rest.patch(EMOJI(this.guild.id, this.id!)) return true }