Documentation ¶
Index ¶
- Variables
- type Audio
- type BaseMedia
- type Bot
- type BotOption
- func WithAPIEndpoint(apiEndpoint string) BotOption
- func WithCommand(cmd string, callback any) BotOption
- func WithDefaultMessageHandler(h func(context.Context, string) error) BotOption
- func WithDialog(name string, h DialogHandler) BotOption
- func WithDialogTTL(ttl time.Duration) BotOption
- func WithLogger(logger *slog.Logger) BotOption
- func WithOffset(offset int) BotOption
- func WithRedisDSN(redisDSN string) BotOption
- func WithTimeout(timeout int) BotOption
- type BotOptions
- type Chat
- func (chat Chat) GetCache() (razcache.Cache, error)
- func (chat Chat) GetID() int64
- func (chat Chat) SendMedia(media ...Media) error
- func (chat Chat) SendMessage(format string, args ...any) error
- func (chat Chat) SendSticker(stickerSet string, num int) error
- func (chat Chat) UploadFile(name string, r io.Reader) error
- func (chat Chat) UploadFileFromURL(url string) error
- type CommandResponse
- func ReplyMedia(media ...Media) CommandResponse
- func ReplySticker(stickerSet string, num int) CommandResponse
- func SendMedia(media ...Media) CommandResponse
- func SendMessage(format string, args ...any) CommandResponse
- func SendReply(format string, args ...any) CommandResponse
- func SendSticker(stickerSet string, num int) CommandResponse
- func StartDialog(name string) CommandResponse
- func UploadFile(name string, r io.Reader) CommandResponse
- func UploadFileFromURL(url string) CommandResponse
- type Context
- func (ctx *Context) DownloadFile(fileID string) (io.ReadCloser, error)
- func (ctx *Context) GetChat() Chat
- func (ctx *Context) GetChatCache() (razcache.Cache, error)
- func (ctx *Context) GetChatID() int64
- func (ctx *Context) GetTaggedUserCache(num int) (razcache.Cache, error)
- func (ctx *Context) GetTaggedUserCount() int
- func (ctx *Context) GetUserCache() (razcache.Cache, error)
- func (ctx *Context) ReplyMedia(media ...Media) error
- func (ctx *Context) ReplySticker(stickerSet string, num int) error
- func (ctx *Context) SendMedia(media ...Media) error
- func (ctx *Context) SendMessage(format string, args ...any) error
- func (ctx *Context) SendReply(format string, args ...any) error
- func (ctx *Context) SendSticker(stickerSet string, num int) error
- func (ctx *Context) StartDialog(name string) error
- func (ctx *Context) UploadFile(name string, r io.Reader) error
- func (ctx *Context) UploadFileFromURL(url string) error
- type Dialog
- func (dlg *Dialog) LastQuery() *Query
- func (dlg *Dialog) LastQueryName() string
- func (dlg *Dialog) LastUserChoices() ([]int, bool)
- func (dlg *Dialog) LastUserResponse() (string, bool)
- func (dlg *Dialog) Query(queryName string) *Query
- func (dlg *Dialog) UserChoices(queryName string) (results []int, ok bool)
- func (dlg *Dialog) UserResponse(queryName string) (string, bool)
- type DialogBuilder
- func (db *DialogBuilder) AddFileInputQuery(text string, validator func(io.Reader) error) *DialogBuilder
- func (db *DialogBuilder) AddMultiChoiceQuery(text string, validator func(choices []int) error, choices ...string) *DialogBuilder
- func (db *DialogBuilder) AddSingleChoiceQuery(text string, validator func(choice int) error, choices ...string) *DialogBuilder
- func (db *DialogBuilder) AddTextInputQuery(text string, validator func(resp string) error) *DialogBuilder
- func (db *DialogBuilder) Build() DialogHandler
- func (db *DialogBuilder) SetFinalizer(finalizer func(ctx *Context, responses []any)) *DialogBuilder
- type DialogHandler
- type Media
- type MediaSource
- type Photo
- type Query
- type QueryKind
- type Video
Constants ¶
This section is empty.
Variables ¶
View Source
var RetryQuery = &Query{Kind: RetryQueryKind}
Functions ¶
This section is empty.
Types ¶
type BaseMedia ¶
type BaseMedia struct { File MediaSource Thumb MediaSource Caption string }
type Bot ¶
type Bot struct { BotOptions // contains filtered or unexported fields }
func (*Bot) DownloadFile ¶
func (bot *Bot) DownloadFile(fileID string) (io.ReadCloser, error)
type BotOption ¶
type BotOption func(*BotOptions)
func WithAPIEndpoint ¶
func WithCommand ¶
func WithDialog ¶
func WithDialog(name string, h DialogHandler) BotOption
func WithDialogTTL ¶
func WithLogger ¶
func WithOffset ¶
func WithRedisDSN ¶
func WithTimeout ¶
type BotOptions ¶
type BotOptions struct {
// contains filtered or unexported fields
}
type Chat ¶
type Chat struct {
// contains filtered or unexported fields
}
func (Chat) UploadFileFromURL ¶
type CommandResponse ¶
func ReplyMedia ¶
func ReplyMedia(media ...Media) CommandResponse
func ReplySticker ¶
func ReplySticker(stickerSet string, num int) CommandResponse
func SendMedia ¶
func SendMedia(media ...Media) CommandResponse
func SendMessage ¶
func SendMessage(format string, args ...any) CommandResponse
func SendReply ¶
func SendReply(format string, args ...any) CommandResponse
func SendSticker ¶
func SendSticker(stickerSet string, num int) CommandResponse
func StartDialog ¶
func StartDialog(name string) CommandResponse
func UploadFile ¶
func UploadFile(name string, r io.Reader) CommandResponse
func UploadFileFromURL ¶
func UploadFileFromURL(url string) CommandResponse
type Context ¶
func (*Context) DownloadFile ¶
func (ctx *Context) DownloadFile(fileID string) (io.ReadCloser, error)
func (*Context) GetTaggedUserCache ¶
func (*Context) GetTaggedUserCount ¶
func (*Context) ReplyMedia ¶
func (*Context) StartDialog ¶
func (*Context) UploadFileFromURL ¶
type Dialog ¶
type Dialog struct {
// contains filtered or unexported fields
}
func (*Dialog) LastQueryName ¶
func (*Dialog) LastUserChoices ¶
func (*Dialog) LastUserResponse ¶
func (*Dialog) UserChoices ¶
type DialogBuilder ¶
type DialogBuilder struct {
// contains filtered or unexported fields
}
func NewDialogBuilder ¶
func NewDialogBuilder() *DialogBuilder
func (*DialogBuilder) AddFileInputQuery ¶
func (db *DialogBuilder) AddFileInputQuery(text string, validator func(io.Reader) error) *DialogBuilder
func (*DialogBuilder) AddMultiChoiceQuery ¶
func (db *DialogBuilder) AddMultiChoiceQuery(text string, validator func(choices []int) error, choices ...string) *DialogBuilder
func (*DialogBuilder) AddSingleChoiceQuery ¶
func (db *DialogBuilder) AddSingleChoiceQuery(text string, validator func(choice int) error, choices ...string) *DialogBuilder
func (*DialogBuilder) AddTextInputQuery ¶
func (db *DialogBuilder) AddTextInputQuery(text string, validator func(resp string) error) *DialogBuilder
func (*DialogBuilder) Build ¶
func (db *DialogBuilder) Build() DialogHandler
func (*DialogBuilder) SetFinalizer ¶
func (db *DialogBuilder) SetFinalizer(finalizer func(ctx *Context, responses []any)) *DialogBuilder
type DialogHandler ¶
type MediaSource ¶
type MediaSource interface {
// contains filtered or unexported methods
}
func FileSource ¶
func FileSource(name string, r io.Reader) MediaSource
func URLSource ¶
func URLSource(url string) MediaSource
type Query ¶
type Query struct { Name string `json:"name"` Kind QueryKind `json:"kind"` Text string `json:"text"` Choices []string `json:"choices,omitempty"` MessageID int `json:"message_id,omitempty"` }
func NewFileInputQuery ¶
func NewMultiChoiceQuery ¶
func NewSingleChoiceQuery ¶
func NewTextInputQuery ¶
type QueryKind ¶
type QueryKind int
func (QueryKind) HasChoiceResponse ¶
func (QueryKind) HasTextResponse ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.