Fix errors

This commit is contained in:
DjDeveloperr 2020-11-08 14:17:01 +05:30
parent b15c5fb79d
commit 7ba21edae2
2 changed files with 6 additions and 10 deletions

View file

@ -1,24 +1,21 @@
import { Client } from '../models/client.ts'
import { Emoji } from '../structures/emoji.ts'
import { Guild } from '../structures/guild.ts'
import { EmojiPayload } from '../types/emoji.ts'
import { GUILD_EMOJI } from '../types/endpoint.ts'
import { BaseManager } from './base.ts'
export class EmojisManager extends BaseManager<EmojiPayload, Emoji> {
guild: Guild
constructor (client: Client, guild: Guild) {
super(client, `emojis:${guild.id}`, Emoji)
this.guild = guild
constructor (client: Client) {
super(client, `emojis`, Emoji)
}
async fetch (id: string): Promise<Emoji> {
async fetch (guildID: string, id: string): Promise<Emoji> {
return await new Promise((resolve, reject) => {
this.client.rest
.get(GUILD_EMOJI(this.guild.id, id))
.then(data => {
this.set(id, data as EmojiPayload)
.get(GUILD_EMOJI(guildID, id))
.then(async data => {
await this.set(id, data as EmojiPayload)
resolve(new Emoji(this.client, data as EmojiPayload))
})
.catch(e => reject(e))

View file

@ -66,7 +66,6 @@ export class Guild extends Base {
this
)
this.roles = new RolesManager(this.client, this)
this.emojis = new EmojisManager(this.client)
if (!this.unavailable) {
this.name = data.name