types

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BotName

type BotName string

BotName is a given bot name from the configs.

func BotToName added in v1.0.0

func BotToName(bot tgkit.Bot) BotName

BotToName returns BotName from the bot's ID.

func (*BotName) Set

func (n *BotName) Set(val string) error

func (*BotName) String

func (n *BotName) String() string

func (*BotName) Type

func (n *BotName) Type() string

type ChatName

type ChatName string

ChatName is a given chat name from the configs.

func ChatIDToName added in v1.0.0

func ChatIDToName(chatID tgkit.ChatID) ChatName

ChatIDToName returns ChatName from the chat ID.

func (*ChatName) Set

func (n *ChatName) Set(val string) error

func (*ChatName) String

func (n *ChatName) String() string

func (*ChatName) Type

func (n *ChatName) Type() string

type KeyVal added in v0.4.0

type KeyVal map[string]string

KeyVal is a key-value strings map.

type KitchenTime added in v0.3.1

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

KitchenTime is a hh:mm:ss time.

func MustParseKitchenTime added in v0.3.1

func MustParseKitchenTime(input string) KitchenTime

MustParseKitchenTime parses input string into the KitchenTime value and panics on the error.

func ParseKitchenTime added in v0.3.1

func ParseKitchenTime(input string) (KitchenTime, error)

ParseKitchenTime parses input string into the KitchenTime value.

func (KitchenTime) String added in v0.3.1

func (k KitchenTime) String() string

func (KitchenTime) Time added in v0.3.1

func (k KitchenTime) Time() time.Time

Time converts KitchenTime into the time.Time value.

type MessageOptions added in v0.5.0

type MessageOptions struct {
	Text      string
	ParseMode ParseMode

	DisableNotification bool
	ProtectContent      bool
}

MessageOptions is a sending message content options.

func (MessageOptions) Validate added in v0.5.0

func (m MessageOptions) Validate() error

type Named added in v1.0.0

type Named[TNames cmp.Ordered, TValues any] struct {
	// contains filtered or unexported fields
}

Named is a container for items indexed by names with a list of ordered names.

func NewNamed added in v1.0.0

func NewNamed[TNames cmp.Ordered, TValues any](
	defaultName TNames,
	nameFallbackFunc ...func(item TValues) TNames,
) *Named[TNames, TValues]

NewNamed creates new Named instance.

func (*Named[TNames, TValues]) Add added in v1.0.0

func (n *Named[TNames, TValues]) Add(name TNames, item TValues)

Add an item.

func (*Named[TNames, TValues]) FindByName added in v1.0.0

func (n *Named[TNames, TValues]) FindByName(name TNames) (TValues, error)

FindByName finds item by its name.

func (*Named[TNames, TValues]) FindByNameIndex added in v1.0.0

func (n *Named[TNames, TValues]) FindByNameIndex(index int) (TValues, error)

FindByNameIndex finds item by its name index.

func (*Named[TNames, TValues]) GetDefaultName added in v1.0.0

func (n *Named[TNames, TValues]) GetDefaultName() TNames

GetDefaultName returns name registered as a default one.

func (*Named[TNames, TValues]) GetNames added in v1.0.0

func (n *Named[TNames, TValues]) GetNames() []TNames

GetNames returns ordered list of the items' names.

func (*Named[TNames, TValues]) Len added in v1.0.0

func (n *Named[TNames, TValues]) Len() int

Len returns count of the items.

func (*Named[TNames, TValues]) SetDefaultName added in v1.0.0

func (n *Named[TNames, TValues]) SetDefaultName(name TNames)

SetDefaultName sets name as a default item name.

type ParseMode added in v0.0.5

type ParseMode string

ParseMode is a message parse mode.

const (
	ParseModeDefault   ParseMode = ""
	ParseModeMarkdown2 ParseMode = "MarkdownV2"
	ParseModeHTML      ParseMode = "HTML"
)

func (*ParseMode) Set added in v0.0.5

func (m *ParseMode) Set(val string) error

func (*ParseMode) String added in v0.0.5

func (m *ParseMode) String() string

func (*ParseMode) Type added in v0.0.5

func (m *ParseMode) Type() string

type SendOptions added in v0.5.0

type SendOptions struct {
	BotName  BotName
	ChatName ChatName

	Message MessageOptions
}

SendOptions are an options of the sending message.

func (SendOptions) GetNormalized added in v0.5.0

func (opt SendOptions) GetNormalized(defaultBotName BotName, defaultChatName ChatName) SendOptions

func (SendOptions) Validate added in v0.5.0

func (opt SendOptions) Validate() error

type TimeInterval added in v0.3.1

type TimeInterval struct {
	From KitchenTime
	To   KitchenTime
}

TimeInterval is a from-to interval.

func (TimeInterval) Has added in v0.3.1

func (t TimeInterval) Has(now time.Time) bool

Has checks if given time is in the interval.

type TimeSchedule added in v0.3.1

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

TimeSchedule is a list of intervals.

func (*TimeSchedule) AddInterval added in v0.3.1

func (s *TimeSchedule) AddInterval(interval TimeInterval)

AddInterval adds TimeInterval into the schedule.

func (*TimeSchedule) Has added in v0.3.1

func (s *TimeSchedule) Has(t time.Time) bool

Has checks if given time is in one of the scheduled intervals.

type UserName added in v0.0.5

type UserName string

UserName is a user's name from the configs.

func (*UserName) Set added in v0.0.5

func (n *UserName) Set(val string) error

func (*UserName) String added in v0.0.5

func (n *UserName) String() string

func (*UserName) Type added in v0.0.5

func (n *UserName) Type() string

Jump to

Keyboard shortcuts

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