tg

package
v0.0.0-...-34c2365 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2022 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 ApiResponse

type ApiResponse struct {
	Ok     bool     `json:"ok"`
	Result []Update `json:"result"`
}

type Bot

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

func NewBotPolling

func NewBotPolling(tg Telega, ps Peasant, errLg log.Logger) Bot

func (*Bot) Run

func (bot *Bot) Run() error

type CallbackQuery

type CallbackQuery struct {
	Id              string  `json:"id"`
	From            User    `json:"from"`
	Message         Message `json:"message"`
	InlineMessageId string  `json:"inline_message_id"`
	ChatInstance    string  `json:"chat_instance"`
	Data            string  `json:"data"`
	GameShortName   string  `json:"game_short_name"`
}

type FkMulti

type FkMulti struct {
	Forks []Fork
}

type FkPattern

type FkPattern struct {
	Pattern regexp.Regexp
	Ps      Peasant
}

type FkUpdType

type FkUpdType struct {
	Type UpdType
	Ps   Peasant
}

type Fork

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

type GetUpdatesReq

type GetUpdatesReq struct {
	Offset         *int32    `json:"offset"`
	Limit          *int      `json:"limit"`
	Timeout        *int      `json:"timeout"`
	AllowedUpdates *[]string `json:"allowed_updates"`
}

type Location

type Location struct {
	Longitude float32 `json:"longtitude"`
	Latitude  float32 `json:"latitude"`
}

type Message

type Message struct {
	MessasgeId int32    `json:"message_id"`
	From       User     `json:"from"`
	Text       string   `json:"text"`
	Location   Location `json:"location"`
}

type Peasant

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

type PsErrorCatching

type PsErrorCatching struct {
	Log log.Logger
	Ps  Peasant
}

type PsFixedTxt

type PsFixedTxt struct {
	Tg  Telega
	Txt string
}

type PsFork

type PsFork struct {
	Forks []Fork
}

func PsForkOf

func PsForkOf(forks ...Fork) PsFork

type SendMessage

type SendMessage struct {
	ChatId int32  `json:"chat_id"`
	Text   string `json:"text"`
}

type Telega

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

func NewTelega

func NewTelega(token string) Telega

func (*Telega) Call

func (tg *Telega) Call(method string, payload []byte) (int, []byte, error)

func (*Telega) Call_

func (tg *Telega) Call_(method string, payload []byte) ([]byte, error)

func (*Telega) NewReq

func (tg *Telega) NewReq(method string, payload []byte) (*http.Request, error)

type UpdType

type UpdType string
const (
	UtMessage            UpdType = "message"
	UtEditedMessage      UpdType = "edited_message"
	UtChannelPost        UpdType = "channel_post"
	UtEditedChannelPost  UpdType = "edited_channel_post"
	UtInluneQuery        UpdType = "inline_query"
	UtChosenInlineResult UpdType = "chosen_inline_result"
	UtCallbackQuery      UpdType = "callback_query"
	UtShippingQuery      UpdType = "shipping_query"
	UtPreCheckoutQuery   UpdType = "pre_checkout_query"
	UtPoll               UpdType = "poll"
	UtPollAnswer         UpdType = "poll_answer"
	UtMyChatMember       UpdType = "my_chat_member"
	UtChatMember         UpdType = "chat_member"
	UtChatJoinRequest    UpdType = "chat_join_request"
)

type Update

type Update struct {
	UpdateId      int32         `json:"update_id"`
	Message       Message       `json:"message"`
	CallbackQuery CallbackQuery `json:"callback_query"`
}

type Updates

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

func UpdatesPolling

func UpdatesPolling(tg Telega) Updates

func (*Updates) FetchUpdates

func (u *Updates) FetchUpdates(req GetUpdatesReq) ([]Update, error)

func (*Updates) NextUpdate

func (u *Updates) NextUpdate() (Update, error)

type User

type User struct {
	Id        int32  `json:"id"`
	FirstName string `json:"first_name"`
	LastName  string `json:"last_name"`
	Username  string `json:"username"`
	Lang      string `json:"language_code"`
}

Jump to

Keyboard shortcuts

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