api

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

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

API represents the Telegram API

func New

func New(cfg telegram.Telegram) (*API, error)

New creates new Telegram API

func (*API) SendPhotoMessage

func (api *API) SendPhotoMessage(mes *PhotoMessage) error

SendPhotoMessage send PhotoMessage to the Telegram API

func (*API) SendTextMessage

func (api *API) SendTextMessage(mes *TextMessage) error

SendTextMessage send TextMessage to the Telegram API

type PhotoMessage

type PhotoMessage struct {
	ChatID  int64  `json:"chat_id"`
	Photo   string `json:"photo"`
	Caption string `json:"caption,omitempty"`
}

PhotoMessage represents PhotoMessage from Telegram API

func NewPhotoMessage

func NewPhotoMessage(chatID int64, photo, text string) *PhotoMessage

NewPhotoMessage creates new PhotoMessage

type TextMessage

type TextMessage struct {
	ChatID    int64  `json:"chat_id"`
	Text      string `json:"text"`
	ParseMode string `json:"parse_mode"`
}

TextMessage represents TextMessage from Telegram API

func NewTextMessage

func NewTextMessage(chatID int64, text string) *TextMessage

NewTextMessage creates new TextMessage

Jump to

Keyboard shortcuts

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