fix: use emojis cache

This commit is contained in:
MARCROCK22 2024-05-25 16:22:21 -04:00
parent d06cd2e847
commit 0dbb331e71

View File

@ -39,7 +39,7 @@ export class EmojiShorter extends BaseShorter {
const emoji = await this.client.proxy.guilds(guildId).emojis.post({ const emoji = await this.client.proxy.guilds(guildId).emojis.post({
body: bodyResolved, body: bodyResolved,
}); });
await this.client.cache.channels?.setIfNI('GuildEmojisAndStickers', emoji.id!, guildId, emoji); await this.client.cache.emojis?.setIfNI('GuildEmojisAndStickers', emoji.id!, guildId, emoji);
return new GuildEmoji(this.client, emoji, guildId); return new GuildEmoji(this.client, emoji, guildId);
} }
@ -68,7 +68,7 @@ export class EmojiShorter extends BaseShorter {
*/ */
async delete(guildId: string, emojiId: string, reason?: string) { async delete(guildId: string, emojiId: string, reason?: string) {
await this.client.proxy.guilds(guildId).emojis(emojiId).delete({ reason }); await this.client.proxy.guilds(guildId).emojis(emojiId).delete({ reason });
await this.client.cache.channels?.removeIfNI('GuildEmojisAndStickers', emojiId, guildId); await this.client.cache.emojis?.removeIfNI('GuildEmojisAndStickers', emojiId, guildId);
} }
/** /**
@ -81,7 +81,7 @@ export class EmojiShorter extends BaseShorter {
*/ */
async edit(guildId: string, emojiId: string, body: RESTPatchAPIGuildEmojiJSONBody, reason?: string) { async edit(guildId: string, emojiId: string, body: RESTPatchAPIGuildEmojiJSONBody, reason?: string) {
const emoji = await this.client.proxy.guilds(guildId).emojis(emojiId).patch({ body, reason }); const emoji = await this.client.proxy.guilds(guildId).emojis(emojiId).patch({ body, reason });
await this.client.cache.channels?.setIfNI('GuildEmojisAndStickers', emoji.id!, guildId, emoji); await this.client.cache.emojis?.setIfNI('GuildEmojisAndStickers', emoji.id!, guildId, emoji);
return new GuildEmoji(this.client, emoji, guildId); return new GuildEmoji(this.client, emoji, guildId);
} }
} }