telegrambot

package
v1.0.101 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2020 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TelegramBot

type TelegramBot struct {
	Token          string `yaml:"BotToken"`
	ChatID         string `yaml:"ChatID"`
	RequestURL     string
	Request        *fasthttp.Request
	Response       *fasthttp.Response
	FastHTTPClient *fasthttp.Client
	// contains filtered or unexported fields
}

TelegramBot struct with tiken and one chatid

func NewTelegramBot

func NewTelegramBot(confPath string) (tb *TelegramBot, err error)

NewTelegramBot reads a config file for bot token and chatID and creates new TelegramBot struct

func NewTelegramBotFromEnv

func NewTelegramBotFromEnv() (tb *TelegramBot, err error)

NewTelegramBot is a constructor from ENV

func (*TelegramBot) FastRequest

func (tbot *TelegramBot) FastRequest(action string, params map[string]string) error

FastRequest make fasthttp request

func (*TelegramBot) GetChat

func (tbot *TelegramBot) GetChat(name string) error

SendMessage is used for sending messages

func (*TelegramBot) GetChatMember

func (tbot *TelegramBot) GetChatMember(name string, user string) error

SendMessage is used for sending messages

func (*TelegramBot) GetChatMemberCount

func (tbot *TelegramBot) GetChatMemberCount(name string) error

SendMessage is used for sending messages

func (*TelegramBot) GetResult

func (tbot *TelegramBot) GetResult() interface{}

GetResult

func (*TelegramBot) GetUpdates

func (tbot *TelegramBot) GetUpdates() error

SendMessage is used for sending messages

func (*TelegramBot) InviteUser

func (tbot *TelegramBot) InviteUser(name string) error

SendMessage is used for sending messages

func (*TelegramBot) SendMessage

func (tbot *TelegramBot) SendMessage(message string, markdown bool, keys ...interface{}) error

SendMessage is used for sending messages. Arguments keys must contain TelegramKeyboard{} to add keys to your message

func (*TelegramBot) Write

func (tbot *TelegramBot) Write(message []byte) (int, error)

TelegramBotHandler reads bot params from configPath and accepts some log struct to find if its needed to print some mess to telegram bot

type TelegramKeyboard added in v1.0.11

type TelegramKeyboard struct {
	Keyboard        [][]string `json:"keyboard"`
	OneTimeKeyboard bool       `json:"one_time_keyboard"`
	ResizeKeyboard  bool       `json:"resize_keyboard"`
}

struct for telegram reply_markup keyboard

Jump to

Keyboard shortcuts

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