gapBotApi

package module
v2.0.13 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: MIT Imports: 17 Imported by: 0

README

gapBotApi Go Package

This package is a Go client library for interacting with GAP Messenger's Bot API. It simplifies sending and receiving messages, as well as handling various types of keyboard inputs, media, and forms.

Installation

To install this package, use go get:

go get github.com/amirimatin/gapBotApi

Usage

Here's a sample usage of the package:

package main

import (
	"fmt"
	"github.com/amirimatin/gapBotApi"
)

func main() {
	// Create a new bot API instance with your token
	api, err := gapBotApi.NewBotAPI("your_bot_api_token_here")
	if err != nil {
		fmt.Println(err.Error())
		return
	}

	// Handle incoming messages with the "/Hi" command
	api.HandleMessage("/Hi", func(botApi *gapBotApi.BotAPI, message *gapBotApi.Message) error {
		msg := gapBotApi.NewMessage(418705986, "sample response")
		api.Send(msg)
		return nil
	})
    api.HandleCallback("hello", AcceptJoinRequest)
    
    
	// Create a new message with keyboard options
	msg := gapBotApi.NewMessage(418705986, "sample messageHandler")

	// Define a reply keyboard with buttons
	msg.ReplyKeyboardMarkup = gapBotApi.NewReplyKeyboardMarkup(
		gapBotApi.NewKeyboardButtonRow(
			gapBotApi.NewKeyboardButton("YES", "yes"),
			gapBotApi.NewKeyboardButton("NO", "no"),
		),
		gapBotApi.NewKeyboardButtonRow(gapBotApi.NewKeyboardButton("CANCEL", "cancel")),
		gapBotApi.NewKeyboardButtonRow(gapBotApi.NewKeyboardButtonLocation("Your Location")),
		gapBotApi.NewKeyboardButtonRow(gapBotApi.NewKeyboardButtonContact("Your Contact")),
	)

	// Define an inline keyboard with URLs and actions
	msg.InlineKeyboardMarkup = gapBotApi.NewInlineKeyboardMarkup(
		gapBotApi.NewInlineKeyboardRow(
			gapBotApi.NewInlineKeyboardButton("hi", gapBotApi.CallbackQueryAction{
				StatePath: "hello",
				Params: map[string]string{
					"name": "amiri",
				},
			}),
			gapBotApi.NewInlineKeyboardButtonURL("Google", "https://google.com", gapBotApi.INLINE_KEYBOARD_URL_OPENIN_WEBVIEW),
		),
		gapBotApi.NewInlineKeyboardRow(gapBotApi.NewInlineKeyboardButtonPayment("Make Payment", 100, gapBotApi.INLINE_KEYBOARD_CURRENCY_IRR, "payment_id", "Payment Description")),
	)

	// Define a form with input options
	options := []gapBotApi.FormObjectOption{
		{"male": "male"},
		{"female": "female"},
	}
	msg.Form = gapBotApi.NewForm(
		gapBotApi.NewFormObjectQrcode("scan", "Scan this code"),
		gapBotApi.NewFormObjectCheckbox("agree", "I Agree"),
		gapBotApi.NewFormObjectRadioInput("gender", "Gender", options),
		gapBotApi.NewFormObjectSelect("gender", "Gender", options),
		gapBotApi.NewFormObjectSubmit("Submit", "Submit"),
	)

	// Send a photo
	photo := gapBotApi.FilePath("/path/to/photo.jpg")
	mPhoto := gapBotApi.NewPhoto(418705986, photo)
	mPhoto.Description = "Sample Photo"
	fmt.Println(api.Send(mPhoto))

	// Send a video or any other file
	video := gapBotApi.FilePath("/path/to/file.mp4")
	mVideo := gapBotApi.NewFile(418705986, video)
	mVideo.Description = "Sample Video"
	fmt.Println(api.Send(mVideo))

	// Send the message with keyboards and form
	fmt.Println(api.Send(msg))
}
func AcceptJoinRequest(botApi *gapBotApi.BotAPI, callback *gapBotApi.CallbackQuery) error {
		// Process accepting join request
		msg := gapBotApi.NewMessage(callback.From.ID, "Join request accepted")
		return botApi.Send(msg)
}

Features

  • Handle Messages: Easily handle messages based on commands or text.
  • Handle Callbacks: Capture and respond to user interactions like button clicks using callback handlers.
  • Reply and Inline Keyboards: Create and send interactive keyboards.
  • Forms: Use forms with inputs like checkboxes, radio buttons, and file uploads.
  • Media Support: Send photos, videos, and files.
  • Payment Integration: Add inline buttons for making payments.

Example Callback Handling

api.HandleCallback("admin.join.accept", AcceptJoinRequest)

func AcceptJoinRequest(botApi *gapBotApi.BotAPI, callback *gapBotApi.CallbackQuery) error {
	msg := gapBotApi.NewMessage(callback.From.ID, "Join request accepted")
	return botApi.Send(msg)
}

Important Note for Integration

To use this package, you need to ensure that the bot callback body format is set to JSON. This change is necessary for proper functionality of the package. Please contact the Gap Messenger support team to request this update.

License

This project is licensed under the MIT License. This means you are free to use, modify, distribute, and incorporate this project in your own software, even for commercial purposes, as long as you include the original copyright notice and this license in any substantial portions of the software.

The software is provided "as is", without warranty of any kind. For more details, refer to the LICENSE file.

Documentation

Index

Constants

View Source
const (
	ChatTyping          = "typing"
	ChatUploadPhoto     = "upload_photo"
	ChatRecordVideo     = "record_video"
	ChatUploadVideo     = "upload_video"
	ChatRecordVoice     = "record_voice"
	ChatUploadVoice     = "upload_voice"
	ChatUploadDocument  = "upload_document"
	ChatChooseSticker   = "choose_sticker"
	ChatFindLocation    = "find_location"
	ChatRecordVideoNote = "record_video_note"
	ChatUploadVideoNote = "upload_video_note"
)

Constant values for ChatActions

View Source
const (
	// APIEndpoint is the Endpoint for all API methods,
	// with formatting for Sprintf.
	APIEndpoint = "https://api.gap.im/%s"
)

Telegram constants

Variables

This section is empty.

Functions

This section is empty.

Types

type APIResponse

type APIResponse struct {
	Error     string `json:"error"`
	TraceId   string `json:"trace_id"`
	MessageId int64  `json:"id"`
}

type AudioConfig

type AudioConfig struct {
	BaseFile
	Description string
}

func NewAudio

func NewAudio(chatID int64, file RequestFileData) AudioConfig

type BaseChat

type BaseChat struct {
	ChatID               int64 // required
	ReplyKeyboardMarkup  interface{}
	InlineKeyboardMarkup InlineKeyboardMarkup
}

BaseChat is base type for all chat config types.

type BaseFile

type BaseFile struct {
	BaseChat
	File RequestFileData
}

BaseFile is a base type for all file config types.

type BotAPI

type BotAPI struct {
	Token          string               `json:"token"`
	Debug          bool                 `json:"debug"`
	Client         *resty.Client        `json:"-"`
	Handlers       map[string][]Handler `json:"-"`
	Middlewares    []Handler            `json:"-"`
	DefaultHandler Handler              `json:"-"`
	// contains filtered or unexported fields
}

BotAPI structure with Resty client

func NewBotAPI

func NewBotAPI(token string) (*BotAPI, error)

NewBotAPI creates a new BotAPI instance.

func NewBotAPIWithClient

func NewBotAPIWithClient(token, apiEndpoint string, client *resty.Client) (*BotAPI, error)

func (*BotAPI) GetHandlers

func (bot *BotAPI) GetHandlers(endpoint string) []Handler

GetHandlers retrieves handlers for a specific endpoint.

func (*BotAPI) Handle

func (bot *BotAPI) Handle(endpoint string, handler ...Handler)

func (*BotAPI) HandleUpdates

func (bot *BotAPI) HandleUpdates(update []byte) (Message, error)

func (*BotAPI) MakeRequest

func (bot *BotAPI) MakeRequest(endpoint string, params Params) (*APIResponse, error)

MakeRequest handles HTTP requests to the specified endpoint with Resty.

func (*BotAPI) MultiSend added in v2.0.12

func (bot *BotAPI) MultiSend(chattables ...Chattable) ([]Message, []error)

func (*BotAPI) Request

func (bot *BotAPI) Request(c Chattable) (*APIResponse, error)

Request sends a request and handles file uploads if needed.

func (*BotAPI) Send

func (bot *BotAPI) Send(c Chattable) (Message, error)

func (*BotAPI) Serve

func (bot *BotAPI) Serve(port int, callbackEndpoint string)

func (*BotAPI) UploadFile

func (bot *BotAPI) UploadFile(params Params, file RequestFile) (*File, error)

UploadFile uploads files using Resty.

func (*BotAPI) Use

func (bot *BotAPI) Use(handler ...Handler)

type CallbackAnswerConfig

type CallbackAnswerConfig struct {
	BaseChat
	CallbackId string `json:"callback_id"`
	Text       string `json:"text"`
	ShowAlert  bool   `json:"show_alert"`
}

func NewAnswerCallback

func NewAnswerCallback(chatID int64, callbackId string, text string, showAlert bool) CallbackAnswerConfig

type CallbackQuery

type CallbackQuery struct {
	MessageID  int64               `json:"message_id"`
	Data       string              `json:"data"`
	QueryActin CallbackQueryAction `json:"-"`
	CallbackId string              `json:"callback_id"`
}

type CallbackQueryAction

type CallbackQueryAction struct {
	StatePath string            `json:"state_path"`
	Params    map[string]string `json:"params"`
}

type Chattable

type Chattable interface {
	// contains filtered or unexported methods
}

type Contact

type Contact struct {
	Id          int64  `json:"id"`
	PhoneNumber string `json:"phone"`
	Name        string `json:"name,omitempty"`
}

type Ctx

type Ctx struct {
	Endpoint string
	Message  *Message
	Params   map[string]interface{}
	context.Context
	HandlerIndex uint
	UserState    UserState
	// contains filtered or unexported fields
}

func (*Ctx) Back

func (ctx *Ctx) Back() (Message, error)

func (*Ctx) Bot

func (ctx *Ctx) Bot() *BotAPI

func (*Ctx) CleanState

func (ctx *Ctx) CleanState()

func (*Ctx) GetContext

func (ctx *Ctx) GetContext() context.Context

func (*Ctx) GetParam

func (ctx *Ctx) GetParam(key string) interface{}

func (*Ctx) Handlers

func (ctx *Ctx) Handlers() []Handler

func (*Ctx) Middlewares

func (ctx *Ctx) Middlewares() []Handler

func (*Ctx) Next

func (ctx *Ctx) Next() (Message, error)

func (*Ctx) ResetUserStack

func (ctx *Ctx) ResetUserStack()

func (*Ctx) SetNextStat

func (ctx *Ctx) SetNextStat(state State)

func (*Ctx) Unmarshal

func (ctx *Ctx) Unmarshal(update []byte) error

func (*Ctx) WithContext

func (ctx *Ctx) WithContext(newCtx context.Context)

func (*Ctx) WithParam added in v2.0.1

func (ctx *Ctx) WithParam(key string, val interface{}) *Ctx

type DeleteMessageConfig

type DeleteMessageConfig struct {
	BaseChat
	Type      MESSAGE_TYPE `json:"type"`
	Text      string       `json:"data"`
	MessageId int64        `json:"message_id"`
}

func NewDeleteMessage

func NewDeleteMessage(chatID int64, messageID int64) DeleteMessageConfig

NewDeleteMessage creates a request to delete a messageHandler.

type Error

type Error struct {
	Message string
}

Error is an error containing extra information returned by the Telegram API.

func (Error) Error

func (e Error) Error() string

type FORM_OBJECTS_TYPE

type FORM_OBJECTS_TYPE string
const (
	FORM_OBJECTS_TYPE_TEXT     FORM_OBJECTS_TYPE = "text"
	FORM_OBJECTS_TYPE_RADIO    FORM_OBJECTS_TYPE = "radio"
	FORM_OBJECTS_TYPE_SELECT   FORM_OBJECTS_TYPE = "select"
	FORM_OBJECTS_TYPE_TEXTAREA FORM_OBJECTS_TYPE = "textarea"
	FORM_OBJECTS_TYPE_INBUILT  FORM_OBJECTS_TYPE = "inbuilt"
	FORM_OBJECTS_TYPE_CHECKBOX FORM_OBJECTS_TYPE = "checkbox"
	FORM_OBJECTS_TYPE_SUBMIT   FORM_OBJECTS_TYPE = "submit"
)

type File

type File struct {
	Id         int64   `json:"id,omitempty"`
	SID        string  `json:"SID,omitempty"`
	RoundVideo bool    `json:"RoundVideo,omitempty"`
	Extension  string  `json:"extension,omitempty"`
	Filename   string  `json:"filename,omitempty"`
	Filesize   int64   `json:"filesize,omitempty"`
	Type       string  `json:"type,omitempty"`
	Width      int64   `json:"width,omitempty"`
	Height     int64   `json:"height,omitempty"`
	Duration   float64 `json:"duration,omitempty"`
	//Desc        string    `json:"desc,omitempty"`
	Path        string    `json:"path,omitempty"`
	Screenshots ImageUrls `json:"image_urls,omitempty"`
}

type FileConfig

type FileConfig struct {
	BaseFile
	Description string
}

func NewFile

func NewFile(chatID int64, file RequestFileData) FileConfig

type FileDta added in v2.0.3

type FileDta struct {
	File
	Description string `json:"desc"`
}

type FilePath

type FilePath string

FilePath is a path to a local file.

func (FilePath) NeedsUpload

func (fp FilePath) NeedsUpload() bool

func (FilePath) SendData

func (fp FilePath) SendData() string

func (FilePath) UploadData

func (fp FilePath) UploadData() (string, io.Reader, error)

type FileReader

type FileReader struct {
	Name   string
	Reader io.Reader
}

FileReader contains information about a reader to upload as a File.

func (FileReader) NeedsUpload

func (fr FileReader) NeedsUpload() bool

func (FileReader) SendData

func (fr FileReader) SendData() string

func (FileReader) UploadData

func (fr FileReader) UploadData() (string, io.Reader, error)

type Fileable

type Fileable interface {
	Chattable
	// contains filtered or unexported methods
}

type FormData

type FormData struct {
	MessageID  int64             `json:"message_id"`
	CallbackID string            `json:"callback_id"`
	RowData    string            `json:"data"`
	Data       map[string]string `json:"-"`
}

type FormObject

type FormObject struct {
	Name    string             `json:"name,omitempty"`
	Type    FORM_OBJECTS_TYPE  `json:"type,omitempty"`
	Label   string             `json:"label,omitempty"`
	Value   string             `json:"value,omitempty"`
	Options []FormObjectOption `json:"options,omitempty"`
}

func NewForm

func NewForm(formObject ...FormObject) []FormObject

func NewFormObjectBarcode

func NewFormObjectBarcode(name, label string) FormObject

func NewFormObjectCheckbox

func NewFormObjectCheckbox(name, label string) FormObject

func NewFormObjectInput

func NewFormObjectInput(name, label string, value ...string) FormObject

func NewFormObjectInputWithValue

func NewFormObjectInputWithValue(name, label, value string) FormObject

func NewFormObjectQrcode

func NewFormObjectQrcode(name, label string) FormObject

func NewFormObjectRadioInput

func NewFormObjectRadioInput(name, label string, options []FormObjectOption) FormObject

func NewFormObjectSelect

func NewFormObjectSelect(name, label string, options []FormObjectOption) FormObject

func NewFormObjectSubmit

func NewFormObjectSubmit(name, label string) FormObject

func NewFormObjectTextarea

func NewFormObjectTextarea(name, label string, value ...string) FormObject

type FormObjectOption

type FormObjectOption map[string]string

type Handler

type Handler func(ctx *Ctx) (Message, error)

type INLINE_KEYBOARD_CURRENCY

type INLINE_KEYBOARD_CURRENCY string
const (
	INLINE_KEYBOARD_CURRENCY_IRR   INLINE_KEYBOARD_CURRENCY = "IRR"
	INLINE_KEYBOARD_CURRENCY_GAPCY INLINE_KEYBOARD_CURRENCY = "coin"
)

type INLINE_KEYBOARD_URL_OPENIN

type INLINE_KEYBOARD_URL_OPENIN string
const (
	INLINE_KEYBOARD_URL_OPENIN_BROWSER             INLINE_KEYBOARD_URL_OPENIN = "browser"
	INLINE_KEYBOARD_URL_OPENIN_INLINE_BROWSER      INLINE_KEYBOARD_URL_OPENIN = "inline_browser"
	INLINE_KEYBOARD_URL_OPENIN_WEBVIEW             INLINE_KEYBOARD_URL_OPENIN = "webview"
	INLINE_KEYBOARD_URL_OPENIN_WEBVIEW_FULL        INLINE_KEYBOARD_URL_OPENIN = "webview_full"
	INLINE_KEYBOARD_URL_OPENIN_WEBVIEW_WITH_HEADER INLINE_KEYBOARD_URL_OPENIN = "webview_with_header"
)

type ImageUrls

type ImageUrls struct {
	Url64  string `json:"64,omitempty"`
	Url128 string `json:"128,omitempty"`
	Url256 string `json:"256,omitempty"`
	Url512 string `json:"512,omitempty"`
}

type InlineKeyboardButton

type InlineKeyboardButton struct {
	Text         string                     `json:"text"`
	CallbackData string                     `json:"cb_data,omitempty"`
	URL          string                     `json:"url,omitempty"`
	OpenIn       INLINE_KEYBOARD_URL_OPENIN `json:"open_in,omitempty"`
	Amount       int                        `json:"amount,omitempty"`
	Currency     INLINE_KEYBOARD_CURRENCY   `json:"currency,omitempty"`
	RefId        string                     `json:"ref_id,omitempty"`
	Description  string                     `json:"desc,omitempty"`
}

func NewInlineKeyboardButton

func NewInlineKeyboardButton(text string, callbackData CallbackQueryAction) InlineKeyboardButton

func NewInlineKeyboardButtonPayment

func NewInlineKeyboardButtonPayment(text string, amount int, currency INLINE_KEYBOARD_CURRENCY, refId, description string) InlineKeyboardButton

func NewInlineKeyboardButtonURL

func NewInlineKeyboardButtonURL(text, url string, openIn INLINE_KEYBOARD_URL_OPENIN) InlineKeyboardButton

func NewInlineKeyboardRow

func NewInlineKeyboardRow(buttons ...InlineKeyboardButton) []InlineKeyboardButton

NewInlineKeyboardRow creates an inline keyboard row with buttons.

type InlineKeyboardMarkup

type InlineKeyboardMarkup [][]InlineKeyboardButton

func NewInlineKeyboardMarkup

func NewInlineKeyboardMarkup(rows ...[]InlineKeyboardButton) InlineKeyboardMarkup

NewInlineKeyboardMarkup creates a new inline keyboard.

func (InlineKeyboardMarkup) AddButtonToEndRow

func (InlineKeyboardMarkup) AddRow

type Location

type Location struct {
	Lat  string `json:"lat"`
	Long string `json:"long"`
	Desc string `json:"desc,omitempty"`
}

type MESSAGE_TYPE

type MESSAGE_TYPE string
const (
	MESSAGE_TYPE_JOIN             MESSAGE_TYPE = "join"
	MESSAGE_TYPE_LEAVE            MESSAGE_TYPE = "leave"
	MESSAGE_TYPE_TEXT             MESSAGE_TYPE = "text"
	MESSAGE_TYPE_IMAGE            MESSAGE_TYPE = "image"
	MESSAGE_TYPE_AUDIO            MESSAGE_TYPE = "audio"
	MESSAGE_TYPE_VIDEO            MESSAGE_TYPE = "video"
	MESSAGE_TYPE_VOICE            MESSAGE_TYPE = "voice"
	MESSAGE_TYPE_FILE             MESSAGE_TYPE = "file"
	MESSAGE_TYPE_CONTACT          MESSAGE_TYPE = "contact"
	MESSAGE_TYPE_LOCATION         MESSAGE_TYPE = "location"
	MESSAGE_TYPE_SUBMITFORM       MESSAGE_TYPE = "submitForm"
	MESSAGE_TYPE_TRIGGER_BUTTON   MESSAGE_TYPE = "triggerButton"
	MESSAGE_TYPE_PAY_CALLBACK     MESSAGE_TYPE = "paycallback"
	MESSAGE_TYPE_INVOICE_CALLBACK MESSAGE_TYPE = "invoicecallback"
)

type Message

type Message struct {
	ChatID        int64         `json:"chat_id"`
	MessageID     int64         `json:"id"`
	Text          string        `json:"text"`
	Data          string        `json:"data"`
	From          User          `json:"from"`
	Type          MESSAGE_TYPE  `json:"type"`
	Photo         File          `json:"photo,omitempty"`
	Video         File          `json:"video,omitempty"`
	Voice         File          `json:"voice,omitempty"`
	Audio         File          `json:"audio,omitempty"`
	File          File          `json:"file,omitempty"`
	PaymentInfo   PaymentInfo   `json:"payment_info,omitempty"`
	CallbackQuery CallbackQuery `json:"callback,omitempty"`
	Contact       Contact       `json:"contact,omitempty"`
	Location      Location      `json:"location,omitempty"`
	FormData      FormData      `json:"form_data,omitempty"`
}

Message represents a messageHandler.

func (*Message) UnmarshalJson

func (message *Message) UnmarshalJson(data []byte) error

type MessageConfig

type MessageConfig struct {
	BaseChat
	Type MESSAGE_TYPE `json:"type"`
	Text string       `json:"data"`
	Form []FormObject `json:"form"`
}

func NewMessage

func NewMessage(chatID int64, text string) MessageConfig

type Params

type Params map[string]string

Params represents a set of parameters that gets passed to a request.

func (Params) AddBool

func (p Params) AddBool(key string, value bool)

AddBool adds a value of a bool if it is true.

func (Params) AddFirstValid

func (p Params) AddFirstValid(key string, args ...interface{}) error

AddFirstValid attempts to add the first item that is not a default value.

For example, AddFirstValid(0, "", "sample") would add "sample".

func (Params) AddInterface

func (p Params) AddInterface(key string, value interface{}) error

AddInterface adds an interface if it is not nil and can be JSON marshalled.

func (Params) AddNonEmpty

func (p Params) AddNonEmpty(key, value string)

AddNonEmpty adds a value if it not an empty string.

func (Params) AddNonZero

func (p Params) AddNonZero(key string, value int)

AddNonZero adds a value if it is not zero.

func (Params) AddNonZero64

func (p Params) AddNonZero64(key string, value int64)

AddNonZero64 is the same as AddNonZero except uses an int64.

func (Params) AddNonZeroFloat

func (p Params) AddNonZeroFloat(key string, value float64)

AddNonZeroFloat adds a floating point value that is not zero.

func (Params) GetParam

func (p Params) GetParam(key string) string

type PaymentInfo

type PaymentInfo struct {
	RefId     string `json:"ref_id"`
	MessageId string `json:"message_id"`
	Status    string `json:"status"`
}

type PhotoConfig

type PhotoConfig struct {
	BaseFile
	Description string
}

func NewPhoto

func NewPhoto(chatID int64, file RequestFileData) PhotoConfig

type ReplyKeyboardButton

type ReplyKeyboardButton map[string]string

func NewKeyboardButton

func NewKeyboardButton(text string, value string) ReplyKeyboardButton

NewKeyboardButton creates a regular keyboard button.

func NewKeyboardButtonContact

func NewKeyboardButtonContact(text string) ReplyKeyboardButton

func NewKeyboardButtonLocation

func NewKeyboardButtonLocation(text string) ReplyKeyboardButton

func NewKeyboardButtonRow

func NewKeyboardButtonRow(buttons ...ReplyKeyboardButton) []ReplyKeyboardButton

type ReplyKeyboardMarkup

type ReplyKeyboardMarkup struct {
	Keyboard [][]ReplyKeyboardButton `json:"keyboard"`
}

func NewReplyKeyboardMarkup

func NewReplyKeyboardMarkup(rows ...[]ReplyKeyboardButton) ReplyKeyboardMarkup

NewReplyKeyboardMarkup creates a new regular keyboard with sane defaults.

type RequestFile

type RequestFile struct {
	// The file field name.
	Name string
	Type MESSAGE_TYPE
	// The file data to include.
	Data RequestFileData
}

type RequestFileData

type RequestFileData interface {
	// NeedsUpload shows if the file needs to be uploaded.
	NeedsUpload() bool

	// UploadData gets the file name and an `io.Reader` for the file to be uploaded. This
	// must only be called when the file needs to be uploaded.
	UploadData() (string, io.Reader, error)
	// SendData gets the file data to send when a file does not need to be uploaded. This
	// must only be called when the file does not need to be uploaded.
	SendData() string
}

type State

type State struct {
	Endpoint string
	Message  *Message
	Params   map[string]interface{}
}

type UpdateMessageConfig

type UpdateMessageConfig struct {
	BaseChat
	Type      MESSAGE_TYPE `json:"type"`
	Text      string       `json:"data"`
	MessageId int64        `json:"message_id"`
}

func NewUpdateMessage

func NewUpdateMessage(chatID int64, messageID int64, text string) UpdateMessageConfig

type UploadResponse

type UploadResponse struct {
	APIResponse `json:"-"`
	File        `json:"-"`
}

type User

type User struct {
	Id        int64  `json:"id,omitempty"`
	UUId      string `json:"uu_id,omitempty"`
	Username  string `json:"user,omitempty"`
	Name      string `json:"name,omitempty"`
	IsDeleted bool   `json:"is_deleted,omitempty"`
}

type UserState

type UserState struct {
	Stack []State
	Next  *State
}

type VideoConfig

type VideoConfig struct {
	BaseFile
	Description string
}

func NewVideo

func NewVideo(chatID int64, file RequestFileData) VideoConfig

type VoiceConfig

type VoiceConfig struct {
	BaseFile
	Description string
}

func NewVoice

func NewVoice(chatID int64, file RequestFileData) VoiceConfig

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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