emoji

package
v1.6.29 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 19, 2026 License: AGPL-3.0 Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package emoji provides utilities for parsing and handling custom emoji in ActivityPub messages and Mastodon-compatible APIs.

Index

Constants

This section is empty.

Variables

View Source
var UnicodeEmojiRegex = regexp.MustCompile(`[\x{1f300}-\x{1f5ff}]|[\x{1f600}-\x{1f64f}]|[\x{1f680}-\x{1f6ff}]|[\x{1f700}-\x{1f77f}]|[\x{1f780}-\x{1f7ff}]|[\x{1f800}-\x{1f8ff}]|[\x{1f900}-\x{1f9ff}]|[\x{1fa00}-\x{1fa6f}]|[\x{1fa70}-\x{1faff}]|[\x{2600}-\x{26ff}]|[\x{2700}-\x{27bf}]|[\x{1f1e6}-\x{1f1ff}]{2}`)

UnicodeEmojiRegex matches Unicode emoji characters This includes basic emojis, emoji with skin tone modifiers, and complex sequences

Functions

This section is empty.

Types

type ParsedResult

type ParsedResult struct {
	CustomEmojis  []mastodon.ParsedEmoji `json:"custom_emojis"`
	UnicodeEmojis []string               `json:"unicode_emojis"`
}

ParsedResult contains both Unicode and custom emojis found in content

type Parser

type Parser struct {
	// contains filtered or unexported fields
}

Parser provides comprehensive emoji parsing functionality

func NewParser

func NewParser(repos core.RepositoryStorage, logger *zap.Logger) *Parser

NewParser creates a new emoji parser with both Unicode and custom emoji support

func (*Parser) GetForStatus

func (p *Parser) GetForStatus(ctx context.Context, content string) ([]any, error)

GetForStatus extracts unique emojis from status content and returns them in Mastodon API format

func (*Parser) ParseAll

func (p *Parser) ParseAll(ctx context.Context, content string) (*ParsedResult, error)

ParseAll extracts both Unicode emojis and custom emoji shortcodes from content

func (*Parser) ProcessContent

func (p *Parser) ProcessContent(ctx context.Context, content string) (string, []any, error)

ProcessContent processes content by parsing emojis and replacing custom emoji shortcodes with HTML

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL