helpers

package
v0.0.0-...-b49c65d Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2017 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckErr

func CheckErr(err error)

CheckErr checks for error and panics if it exists

func DownloadFile

func DownloadFile(url string, filepath string) error

DownloadFile downloads a file and saves it

func GetBotUpdatesChan

func GetBotUpdatesChan(bot *tgbotapi.BotAPI) (<-chan tgbotapi.Update, error)

GetBotUpdatesChan returns updates chan of bot

func GetMainKeyboard

func GetMainKeyboard() tgbotapi.ReplyKeyboardMarkup

GetMainKeyboard returns main bot keyboard

func GetNewBot

func GetNewBot(token string, debug bool) (*tgbotapi.BotAPI, error)

GetNewBot returns a new Telegram bot

func IsCommand

func IsCommand(msg *tgbotapi.Message) bool

IsCommand returns true if message text starts with /

func IsDocument

func IsDocument(msg *tgbotapi.Message) bool

IsDocument returns true if message is a file

func IsFromAdmin

func IsFromAdmin(msg *tgbotapi.Message) bool

IsFromAdmin returns true if message is from an admin

func IsPrivate

func IsPrivate(msg *tgbotapi.Message) bool

IsPrivate returns true if message is a private message

func SendMarkdownMessage

func SendMarkdownMessage(bot *tgbotapi.BotAPI, chatID int, text string) error

SendMarkdownMessage sends a markdown message to a chat

func SendMessage

func SendMessage(bot *tgbotapi.BotAPI, chatID int, text string, markdown bool, keyboard bool) error

SendMessage sends a message to a chat

func SendTextMessage

func SendTextMessage(bot *tgbotapi.BotAPI, chatID int, text string) error

SendTextMessage sends a normal text message to a chat

Types

This section is empty.

Jump to

Keyboard shortcuts

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