bot

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: May 18, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	RedisClient *redis.Client
)

Functions

func Call

func Call(fn_struct interface{}) (responseBody string, err error)

func EditMessageCaption

func EditMessageCaption(client *Client, messageId int64, caption string, args ...interface{}) (err error)

args: 1 - keyboard *constructor.Keyboard

func EditMessageText

func EditMessageText(client *Client, messageId int64, text string, args ...interface{}) (err error)

args: 1 - keyboard *constructor.Keyboard

func GetMessageTypeCallback

func GetMessageTypeCallback(messageTypeHash string) (fn func(client *Client, update *tlg.Update) (string, error), err error)

func MakeTransition

func MakeTransition(client *Client, update *tlg.Update, signal string) (err error)

func SaveClients

func SaveClients() (err error)

func SendMessage

func SendMessage(client *Client, text string, args ...interface{}) (err error)

args: 1 - keyboard *constructor.Keyboard 2 - ProtectContent bool 3 - DisableNotification bool 4 - DisableWebPagePreview bool

func SendPhotoByURL

func SendPhotoByURL(client *Client, photoURL tlg.InputFile, args ...interface{}) (err error)

add - additional parameters: 1. caption string 2. keyboard 3. has_spoiler bool 4. disable_notifiaction bool 5. protect_content bool

func SetMessageType

func SetMessageType(
	fn func(client *Client, update *tlg.Update) (string, error),
	types ...int64,
) (err error)

func SetRedisPrefixKey

func SetRedisPrefixKey(prefix string)

func SetStates

func SetStates(stateNames ...string) (err error)

func SetToken

func SetToken(token string)

func SetTransition

func SetTransition(
	stateFrom, stateTo, signal string,
	fn func(client *Client, update *tlg.Update) error,
) (err error)

func SetupRedisSettings

func SetupRedisSettings(addr, password string, db int) (err error)

Types

type Client

type Client struct {
	ID    int64   `gorm:"primaryKey"`
	State *_State `gorm:"embedded"`
}

func GetClient

func GetClient(id int64) (client *Client, err error)

func (*Client) SetState

func (client *Client) SetState(stateName string) (err error)

Jump to

Keyboard shortcuts

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