Fix errors
This commit is contained in:
parent
b15c5fb79d
commit
7ba21edae2
2 changed files with 6 additions and 10 deletions
|
@ -1,24 +1,21 @@
|
||||||
import { Client } from '../models/client.ts'
|
import { Client } from '../models/client.ts'
|
||||||
import { Emoji } from '../structures/emoji.ts'
|
import { Emoji } from '../structures/emoji.ts'
|
||||||
import { Guild } from '../structures/guild.ts'
|
|
||||||
import { EmojiPayload } from '../types/emoji.ts'
|
import { EmojiPayload } from '../types/emoji.ts'
|
||||||
import { GUILD_EMOJI } from '../types/endpoint.ts'
|
import { GUILD_EMOJI } from '../types/endpoint.ts'
|
||||||
import { BaseManager } from './base.ts'
|
import { BaseManager } from './base.ts'
|
||||||
|
|
||||||
export class EmojisManager extends BaseManager<EmojiPayload, Emoji> {
|
export class EmojisManager extends BaseManager<EmojiPayload, Emoji> {
|
||||||
guild: Guild
|
|
||||||
|
|
||||||
constructor (client: Client, guild: Guild) {
|
constructor (client: Client) {
|
||||||
super(client, `emojis:${guild.id}`, Emoji)
|
super(client, `emojis`, Emoji)
|
||||||
this.guild = guild
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async fetch (id: string): Promise<Emoji> {
|
async fetch (guildID: string, id: string): Promise<Emoji> {
|
||||||
return await new Promise((resolve, reject) => {
|
return await new Promise((resolve, reject) => {
|
||||||
this.client.rest
|
this.client.rest
|
||||||
.get(GUILD_EMOJI(this.guild.id, id))
|
.get(GUILD_EMOJI(guildID, id))
|
||||||
.then(data => {
|
.then(async data => {
|
||||||
this.set(id, data as EmojiPayload)
|
await this.set(id, data as EmojiPayload)
|
||||||
resolve(new Emoji(this.client, data as EmojiPayload))
|
resolve(new Emoji(this.client, data as EmojiPayload))
|
||||||
})
|
})
|
||||||
.catch(e => reject(e))
|
.catch(e => reject(e))
|
||||||
|
|
|
@ -66,7 +66,6 @@ export class Guild extends Base {
|
||||||
this
|
this
|
||||||
)
|
)
|
||||||
this.roles = new RolesManager(this.client, this)
|
this.roles = new RolesManager(this.client, this)
|
||||||
this.emojis = new EmojisManager(this.client)
|
|
||||||
|
|
||||||
if (!this.unavailable) {
|
if (!this.unavailable) {
|
||||||
this.name = data.name
|
this.name = data.name
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue