detritus-client
Version:
A Typescript NodeJS library to interact with Discord's API, both Rest and Gateway.
65 lines (64 loc) • 2.12 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ApplicationNews = void 0;
const baseset_1 = require("../collections/baseset");
const constants_1 = require("../constants");
const basestructure_1 = require("./basestructure");
const messageembed_1 = require("./messageembed");
const keysApplicationNews = new baseset_1.BaseSet([
constants_1.DiscordKeys.APPLICATION_ID,
constants_1.DiscordKeys.CATEGORY,
constants_1.DiscordKeys.DESCRIPTION,
constants_1.DiscordKeys.FLAGS,
constants_1.DiscordKeys.FOOTER,
constants_1.DiscordKeys.GAME_ID,
constants_1.DiscordKeys.ID,
constants_1.DiscordKeys.THUMBNAIL,
constants_1.DiscordKeys.TIMESTAMP,
constants_1.DiscordKeys.TITLE,
constants_1.DiscordKeys.TYPE,
constants_1.DiscordKeys.URL,
]);
/**
* Application News Structure
* @category Structure
*/
class ApplicationNews extends basestructure_1.BaseStructure {
constructor(client, data, isClone) {
super(client, undefined, isClone);
this._keys = keysApplicationNews;
this.applicationId = '';
this.category = null;
this.description = '';
this.flags = 0;
this.gameId = this.applicationId;
this.id = '';
this.title = '';
this.type = constants_1.MessageEmbedTypes.APPLICATION_NEWS;
this.merge(data);
}
mergeValue(key, value) {
switch (key) {
case constants_1.DiscordKeys.FOOTER:
{
value = new messageembed_1.MessageEmbedFooter(this.client, value);
}
;
break;
case constants_1.DiscordKeys.THUMBNAIL:
{
value = new messageembed_1.MessageEmbedThumbnail(this.client, value);
}
;
break;
case constants_1.DiscordKeys.TIMESTAMP:
{
value = new Date(value);
}
;
break;
}
super.mergeValue(key, value);
}
}
exports.ApplicationNews = ApplicationNews;