entityhelper

package
v1.0.0-my-beta30 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2024 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BoldEntity      entity = 'b'
	ItalicEntity    entity = 'i'
	UnderlineEntity entity = 'u'
	CodeEntity      entity = 'c'
	StrikeEntity    entity = '~'
	SpoilertEntity  entity = 's'
)

Variables

This section is empty.

Functions

This section is empty.

Types

type EntityRoot

type EntityRoot struct {
	String   string
	Entities tg.MessageEntityClassArray
}

EntityRoot is used to create message entities from the input string through its various methods.

func Bold

func Bold(s string) *EntityRoot

Bold creates a new entity root and appends the provided string as bold to this entity root.

func BotMention

func BotMention(text string, user interface{}) *EntityRoot

BotMention creates a new entity root and appends the provided string as a mention to this entity root.

func Code

func Code(s string) *EntityRoot

Code creates a new entity root and appends the provided string as code to this entity root.

func Combine

func Combine(s string, entity1, entity2 entity) *EntityRoot

Combine creates a new entity root and appends the provided string as combined entities to this entity root.

func CombineToLink(text, link string, entity entity) *EntityRoot

CombineToLink creates a new entity root and appends the provided string as combined link entities to this entity root.

func Italic

func Italic(s string) *EntityRoot

Italic creates a new entity root and appends the provided string as italic to this entity root.

func Link(text, url string) *EntityRoot

Link creates a new entity root and appends the provided string as a link to this entity root.

func Mention

func Mention(name string, user tg.InputUserClass) *EntityRoot

Mention creates a new entity root and appends the provided string as a mention to this entity root.

func Plain

func Plain(s string) *EntityRoot

Plain creates a new entity root and appends the provided string as plain text to this entity root.

func RawEntity

func RawEntity(entity tg.MessageEntityClass) *EntityRoot

func Spoiler

func Spoiler(s string) *EntityRoot

Spoiler creates a new entity root and appends the provided string as spoiler to this entity root.

func StartParsing

func StartParsing() *EntityRoot

StartParsing function creates an empty EntityRoot. DEPRECATED

func Strike

func Strike(s string) *EntityRoot

Strike creates a new entity root and appends the provided string as strike to this entity root.

func Underline

func Underline(s string) *EntityRoot

Underline creates a new entity root and appends the provided string as underline to this entity root.

func (*EntityRoot) Bold

func (root *EntityRoot) Bold(s string) *EntityRoot

Bold appends the provided string as bold to the entity root.

func (*EntityRoot) BotMention

func (root *EntityRoot) BotMention(text string, user interface{}) *EntityRoot

BotMention creates a telegram user mention link with the provided user and text to display.

NOTE: This method works for bots only

func (*EntityRoot) Code

func (root *EntityRoot) Code(s string) *EntityRoot

Code appends the provided string as code/mono to the entity root.

func (*EntityRoot) Combine

func (root *EntityRoot) Combine(s string, entity1, entity2 entity) *EntityRoot

Combine function combines the entity1 and entity2 and appends the resultant entity to the EntityRoot.

func (root *EntityRoot) CombineToLink(text, link string, entity entity) *EntityRoot

CombineToLink function combines the given entity to the link entity of the EntityRoot.

func (*EntityRoot) GetEntities

func (root *EntityRoot) GetEntities() []tg.MessageEntityClass

func (*EntityRoot) GetString

func (root *EntityRoot) GetString() string

func (*EntityRoot) Italic

func (root *EntityRoot) Italic(s string) *EntityRoot

Italic appends the provided string as italic to the entity root.

func (root *EntityRoot) Link(text, url string) *EntityRoot

Link appends the provided link to the entity root.

func (*EntityRoot) Mention

func (root *EntityRoot) Mention(name string, user tg.InputUserClass) *EntityRoot

Mention appends the provided mention to the entity root.

func (*EntityRoot) Plain

func (root *EntityRoot) Plain(text string) *EntityRoot

Plain appends the provided text to the entity root as it is.

func (*EntityRoot) RawEntity

func (root *EntityRoot) RawEntity(entity tg.MessageEntityClass) *EntityRoot

func (*EntityRoot) Spoiler

func (root *EntityRoot) Spoiler(s string) *EntityRoot

Spoiler appends the provided string as spoiler to the entity root.

func (*EntityRoot) Strike

func (root *EntityRoot) Strike(s string) *EntityRoot

Strike appends the provided string as strike to the entity root.

func (*EntityRoot) Underline

func (root *EntityRoot) Underline(s string) *EntityRoot

Underline appends the provided string as underline to the entity root.

Jump to

Keyboard shortcuts

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