emoji

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2026 License: AGPL-3.0 Imports: 10 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 custom emoji management services for the Lesser ActivityPub server.

This service handles all operations related to custom emojis including: - Creating, updating, and deleting custom emojis - Retrieving emojis for display in the UI - Managing emoji categories and visibility - Handling federation of custom emojis from remote instances

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CopyEmojiCommand

type CopyEmojiCommand struct {
	Shortcode    string `json:"shortcode" validate:"required"`
	Domain       string `json:"domain" validate:"required"`
	NewShortcode string `json:"new_shortcode"` // Optional, use original if not provided
}

CopyEmojiCommand contains data needed to copy a remote emoji

type CreateEmojiCommand

type CreateEmojiCommand struct {
	Shortcode       string `json:"shortcode" validate:"required,min=2,max=30"`
	ImageURL        string `json:"image_url" validate:"required,url"`
	Category        string `json:"category"`
	VisibleInPicker bool   `json:"visible_in_picker"`
}

CreateEmojiCommand contains data needed to create a new emoji

type DeleteEmojiCommand

type DeleteEmojiCommand struct {
	Shortcode string `json:"shortcode" validate:"required"`
}

DeleteEmojiCommand contains data needed to delete an emoji

type GetEmojiQuery

type GetEmojiQuery struct {
	Shortcode string `json:"shortcode" validate:"required"`
}

GetEmojiQuery contains parameters for retrieving a single emoji

type GetPopularEmojisQuery

type GetPopularEmojisQuery struct {
	Domain string `json:"domain"` // Optional, empty for local emojis
	Limit  int    `json:"limit"`
}

GetPopularEmojisQuery contains parameters for getting popular emojis

type IncrementUsageCommand

type IncrementUsageCommand struct {
	Shortcode string `json:"shortcode" validate:"required"`
}

IncrementUsageCommand contains data needed to increment emoji usage

type ListEmojisQuery

type ListEmojisQuery struct {
	OnlyLocal       bool   `json:"only_local"`       // Only show local emojis
	OnlyVisible     bool   `json:"only_visible"`     // Only show visible emojis
	Category        string `json:"category"`         // Filter by category
	IncludeDisabled bool   `json:"include_disabled"` // Include disabled emojis
}

ListEmojisQuery contains parameters for listing emojis

type ListResult

type ListResult struct {
	Emojis []*storage.CustomEmoji `json:"emojis"`
	Total  int                    `json:"total"`
	Events []*streaming.Event     `json:"events"`
}

ListResult contains multiple emojis

type Result

type Result struct {
	Emoji  *storage.CustomEmoji `json:"emoji"`
	Events []*streaming.Event   `json:"events"`
}

Result contains a single emoji

type SearchEmojisQuery

type SearchEmojisQuery struct {
	Query string `json:"query" validate:"required,min=1"`
	Limit int    `json:"limit"`
}

SearchEmojisQuery contains parameters for searching emojis

type Service

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

Service provides business logic for custom emoji operations

func NewService

func NewService(
	emojiRepo emojiRepository,
	publisher streaming.Publisher,
	logger *zap.Logger,
	domain string,
) *Service

NewService creates a new emoji service

func (*Service) CopyRemoteEmoji

func (s *Service) CopyRemoteEmoji(ctx context.Context, cmd *CopyEmojiCommand) (*Result, error)

CopyRemoteEmoji copies a remote emoji to the local instance

func (*Service) CreateEmoji

func (s *Service) CreateEmoji(ctx context.Context, cmd *CreateEmojiCommand) (*Result, error)

CreateEmoji creates a new custom emoji

func (*Service) DeleteEmoji

func (s *Service) DeleteEmoji(ctx context.Context, cmd *DeleteEmojiCommand) error

DeleteEmoji deletes a custom emoji

func (*Service) GetEmoji

func (s *Service) GetEmoji(ctx context.Context, query *GetEmojiQuery) (*storage.CustomEmoji, error)

GetEmoji retrieves a single custom emoji by shortcode

func (*Service) GetPopularEmojis

func (s *Service) GetPopularEmojis(ctx context.Context, query *GetPopularEmojisQuery) (*ListResult, error)

GetPopularEmojis retrieves emojis by popularity score

func (*Service) IncrementUsage

func (s *Service) IncrementUsage(ctx context.Context, cmd *IncrementUsageCommand) error

IncrementUsage increments the usage count for an emoji

func (*Service) ListEmojis

func (s *Service) ListEmojis(ctx context.Context, query *ListEmojisQuery) (*ListResult, error)

ListEmojis retrieves all custom emojis with optional filters

func (*Service) SearchEmojis

func (s *Service) SearchEmojis(ctx context.Context, query *SearchEmojisQuery) (*ListResult, error)

SearchEmojis performs sophisticated emoji searches with relevance scoring

func (*Service) UpdateEmoji

func (s *Service) UpdateEmoji(ctx context.Context, cmd *UpdateEmojiCommand) (*Result, error)

UpdateEmoji updates an existing custom emoji

type UpdateEmojiCommand

type UpdateEmojiCommand struct {
	Shortcode       string  `json:"shortcode" validate:"required"`
	Category        *string `json:"category"`
	VisibleInPicker *bool   `json:"visible_in_picker"`
	Disabled        *bool   `json:"disabled"`
}

UpdateEmojiCommand contains data needed to update an emoji

Jump to

Keyboard shortcuts

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