UNPKG

seyfert

Version:

The most advanced framework for discord bots

51 lines (50 loc) 2.05 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Sticker = void 0; const transformers_1 = require("../client/transformers"); const DiscordBase_1 = require("./extra/DiscordBase"); class Sticker extends DiscordBase_1.DiscordBase { user; constructor(client, data) { super(client, data); if (data.user) { this.user = transformers_1.Transformers.User(this.client, data.user); } } guild(mode = 'flow') { if (!this.guildId) return mode === 'cache' ? (this.client.cache.adapter.isAsync ? Promise.resolve() : undefined) : Promise.resolve(); switch (mode) { case 'cache': return (this.client.cache.guilds?.get(this.guildId) || (this.client.cache.adapter.isAsync ? Promise.resolve() : undefined)); default: return this.client.guilds.fetch(this.guildId, mode === 'rest'); } } async edit(body, reason) { if (!this.guildId) return; return this.client.guilds.stickers.edit(this.guildId, this.id, body, reason); } async fetch(force = false) { if (!this.guildId) return; return this.client.guilds.stickers.fetch(this.guildId, this.id, force); } async delete(reason) { if (!this.guildId) return; return this.client.guilds.stickers.delete(this.guildId, this.id, reason); } static methods({ client, guildId }) { return { list: () => client.guilds.stickers.list(guildId), create: (payload, reason) => client.guilds.stickers.create(guildId, payload, reason), edit: (stickerId, body, reason) => client.guilds.stickers.edit(guildId, stickerId, body, reason), fetch: (stickerId, force = false) => client.guilds.stickers.fetch(guildId, stickerId, force), delete: (stickerId, reason) => client.guilds.stickers.delete(guildId, stickerId, reason), }; } } exports.Sticker = Sticker;