@twurple/common
Version:
Common functions used by the `@twurple` library family.
37 lines (36 loc) • 1.08 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ChatEmote = void 0;
const tslib_1 = require("tslib");
const DataObject_1 = require("../DataObject");
const rtfm_1 = require("../rtfm");
/**
* A chat emote.
*/
let ChatEmote = class ChatEmote extends DataObject_1.DataObject {
/**
* The emote ID.
*/
get id() {
return this[DataObject_1.rawDataSymbol].id;
}
/**
* The emote code, i.e. how you write it in chat.
*/
get code() {
return this[DataObject_1.rawDataSymbol].code;
}
/**
* Build the URL pointing to the emote image.
*
* @param settings The display settings of the emote image.
*/
getUrl(settings) {
const { animationSettings = 'default', backgroundType = 'dark', size = '1.0' } = settings;
return `https://static-cdn.jtvnw.net/emoticons/v2/${this.id}/${animationSettings}/${backgroundType}/${size}`;
}
};
ChatEmote = tslib_1.__decorate([
(0, rtfm_1.rtfm)('common', 'ChatEmote', 'id')
], ChatEmote);
exports.ChatEmote = ChatEmote;