@alex_1699/custom-premium-emoji
v1.0.6
Published
A library for working with premium and regular emojis
Downloads
719
Readme
Premium Emoji
A TypeScript library for working with premium and regular emojis, including Telegram premium emojis with Lucide icons.
Installation
npm install @alex_1699/premium-emojiUsage
import { EmojiService } from "@alex_1699/premium-emoji";
// Get all premium emojis
const premiumEmojis = EmojiService.getAllPremiumEmojis();
// Get premium emoji by name
const premiumEmoji = EmojiService.getPremiumEmojiByName("Star");
console.log(premiumEmoji); // { name: 'Star', custom_emoji_id: '...', emoji: '⭐' }
// Get formatted Telegram tag for premium emoji
const formattedTag = EmojiService.getFormatttedTag("Star");
console.log(formattedTag); // <tg-emoji emoji-id="...">⭐</tg-emoji>
// Get custom emoji ID
const customId = EmojiService.getCustomId("Star");
console.log(customId); // "..."
// Get all regular emojis
const allEmojis = EmojiService.getAllEmojis();
// Get emoji by name
const heartEmoji = EmojiService.getEmojiByName("heart");
console.log(heartEmoji); // ❤️
// Get name by emoji
const emojiName = EmojiService.getNameByEmoji("😀");
console.log(emojiName); // "smile"API
EmojiService.getAllEmojis(): Record<string, string>
Returns an object with all regular emoji names and their symbols.
EmojiService.getEmojiByName(name: string): string | null
Returns emoji symbol by its name, or null if not found.
EmojiService.getNameByEmoji(emoji: string): string | null
Returns emoji name by its symbol, or null if not found.
EmojiService.getAllPremiumEmojis(): PremiumEmoji[]
Returns an array of all premium emojis.
EmojiService.getPremiumEmojiByName(name: PremiumEmojisName): PremiumEmoji | null
Returns premium emoji object by name, or null if not found.
EmojiService.getFormatttedTag(name: PremiumEmojisName): string
Returns formatted Telegram <tg-emoji> tag for the specified emoji name.
EmojiService.getCustomId(name: PremiumEmojisName): string
Returns custom emoji ID for Telegram premium emojis.
Types
interface PremiumEmoji {
name: PremiumEmojisName;
custom_emoji_id: string;
emoji: string;
}
type PremiumEmojisName = 'Star' | 'Heart' | ...; // Union of all premium emoji namesAuthor
Your Name
