usersession

package
v0.0.0-...-493173e Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2022 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Issuer

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

func NewIssuer

func NewIssuer(cfg *conf.Config, tgBot *telegram.Bot, tgExecutor *tglimiter.Executor, vkCli *vk.Client, repo tgstate.Repository) *Issuer

func (*Issuer) Issue

func (i *Issuer) Issue(telegramID int, update *telegram.Update) (s *Session, release func(), err error)

Issue creates a new session and returns it. Also, it locks the session and returns the release function. Hence, you cannot work with a session simultaneously from difference threads. When you stop using the session, you must call release().

type Session

type Session struct {
	TelegramID int
	LastUpdate *telegram.Update

	State *tgstate.State
	// contains filtered or unexported fields
}

func (*Session) AnswerOnLastCallback

func (s *Session) AnswerOnLastCallback()

func (*Session) DeleteLastMessage

func (s *Session) DeleteLastMessage() error

func (*Session) GetVKFriends

func (s *Session) GetVKFriends(id int) ([]friendship.Friend, error)

func (*Session) SaveState

func (s *Session) SaveState() error

func (*Session) SendEditText

func (s *Session) SendEditText(text string, keyboard [][]telegram.InlineKeyboardButton, edit bool) error

SendEditText edits the message received with a callback query. Only InlineKeyboardButton keyboard is supported.

func (*Session) SendInlinePhoto

func (s *Session) SendInlinePhoto(text string, file string, keyboard telegram.AnyKeyboard) error

func (*Session) SendText

func (s *Session) SendText(text string, keyboard ...telegram.AnyKeyboard) error

Jump to

Keyboard shortcuts

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