@twurple/common
Version:
Common functions used by the `@twurple` library family.
34 lines (33 loc) • 930 B
JavaScript
import { __decorate } from "tslib";
import { DataObject, rawDataSymbol } from "../DataObject.mjs";
import { rtfm } from "../rtfm.mjs";
/**
* A chat emote.
*/
let ChatEmote = class ChatEmote extends DataObject {
/**
* The emote ID.
*/
get id() {
return this[rawDataSymbol].id;
}
/**
* The emote code, i.e. how you write it in chat.
*/
get code() {
return this[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 = __decorate([
rtfm('common', 'ChatEmote', 'id')
], ChatEmote);
export { ChatEmote };