UNPKG

@grammyjs/emoji

Version:

Use emoji names instead of Unicode strings. Copy-pasting emoji sucks.

26 lines (25 loc) 963 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Reactions = exports.emojiParser = exports.emoji = void 0; const emojidata_js_1 = require("./emojidata.js"); function emoji(name) { var _a; return (_a = emojidata_js_1.default[name]) !== null && _a !== void 0 ? _a : name; } exports.emoji = emoji; function withEmoji(text, ...emojis) { return text.reduce((acc, str, idx) => { var _a; return acc + str + emoji((_a = emojis[idx]) !== null && _a !== void 0 ? _a : ""); }, ""); } function emojiParser() { return async (ctx, next) => { ctx.emoji = withEmoji; ctx.replyWithEmoji = (text, ...emojis) => ctx.reply(withEmoji(text, ...emojis)); await next(); }; } exports.emojiParser = emojiParser; var reactiondata_js_1 = require("./reactiondata.js"); Object.defineProperty(exports, "Reactions", { enumerable: true, get: function () { return reactiondata_js_1.default; } });