push

package
v0.0.0-...-5a29284 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetTelegramToken

func GetTelegramToken() string

GetTelegramToken get Telegram Bot token

func GetTelegramTokenForURL

func GetTelegramTokenForURL() string

GetTelegramTokenForURL get telegram bot's id

func InitTelegram

func InitTelegram(filePath string)

InitTelegram initialize telegram's bot token

func OnTelegramUpdate

func OnTelegramUpdate(wh WebhookHandler) func(c *gin.Context)

OnTelegramUpdate handler for webhook

func SendMessageTelegram

func SendMessageTelegram(id int64, msg string)

SendMessageTelegram send message to telegram

func SendPhotoTelegram

func SendPhotoTelegram(id int64, caption, picURL string)

SendPhotoTelegram send message to telegram

func URLTelegramUpdate

func URLTelegramUpdate() string

URLTelegramUpdate uri where telegram webhook comes

Types

type Manager

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

Manager manager for push

func NewManager

func NewManager() *Manager

NewManager creates an initialized Push Manager

func (*Manager) PushMessage

func (m *Manager) PushMessage(msg string, userid int64)

PushMessage pushes message to Telegram Bot

func (*Manager) PushPhoto

func (m *Manager) PushPhoto(caption, picURL string, userid int64)

PushPhoto pushes photo to Telegram Bot

type TelegramChat

type TelegramChat struct {
	ID       int64  `json:"id"`
	ChatType string `json:"type"`
	Title    string `json:"title"`
	Username string `json:"username"`
}

TelegramChat TelegramChat

type TelegramMessage

type TelegramMessage struct {
	MessageID int64        `json:"message_id"`
	From      TelegramUser `json:"from"`
	Date      int64        `json:"date"`
	Chat      TelegramChat `json:"chat"`
	Text      string       `json:"text"`
}

TelegramMessage TelegramMessage

type TelegramUpdate

type TelegramUpdate struct {
	UpdateID int64           `json:"update_id"`
	Message  TelegramMessage `json:"message"`
}

TelegramUpdate TelegramUpdate

type TelegramUser

type TelegramUser struct {
	ID           int64  `json:"id"`
	IsBot        bool   `json:"is_bot"`
	FirstName    string `json:"first_name"`
	LastName     string `json:"last_name"`
	Username     string `json:"username"`
	LanguageCode string `json:"language_code"`
}

TelegramUser TelegramUser

type WebhookHandler

type WebhookHandler interface {
	OnWebhook(token int64, msg string)
}

WebhookHandler handler for webhook

Jump to

Keyboard shortcuts

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