detritus-client
Version:
A Typescript NodeJS library to interact with Discord's API, both Rest and Gateway.
43 lines (42 loc) • 1.36 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.PremiumSubscription = void 0;
const baseset_1 = require("../collections/baseset");
const constants_1 = require("../constants");
const utils_1 = require("../utils");
const basestructure_1 = require("./basestructure");
const keysPremiumSubscription = new baseset_1.BaseSet([
constants_1.DiscordKeys.ENDED,
constants_1.DiscordKeys.GUILD_ID,
constants_1.DiscordKeys.ID,
constants_1.DiscordKeys.USER_ID,
]);
/**
* Premium Subscription Structure, details a user's nitro boost on the server
* ATM, only non-bots will ever see these
* @category Structure
*/
class PremiumSubscription extends basestructure_1.BaseStructure {
constructor(client, data, isClone) {
super(client, undefined, isClone);
this._keys = keysPremiumSubscription;
this.ended = false;
this.guildId = '';
this.id = '';
this.userId = '';
this.merge(data);
}
get createdAt() {
return new Date(this.createdAtUnix);
}
get createdAtUnix() {
return utils_1.Snowflake.timestamp(this.id);
}
get guild() {
return this.client.guilds.get(this.guildId) || null;
}
get user() {
return this.client.users.get(this.userId) || null;
}
}
exports.PremiumSubscription = PremiumSubscription;