Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetPageTitle ¶
GetPageTitle returns the <title> of a given page
Types ¶
type BotInfo ¶
BotInfo contains informations about the bot
func (*BotInfo) DecodeJSON ¶
func (u *BotInfo) DecodeJSON(r io.ReadCloser) error
DecodeJSON decodes some JSON into a BotInfo
type Chat ¶
type Chat struct { ID int `json:"id"` FirstName string `json:"first_name"` LastName string `json:"last_name"` Username string `json:"username"` Type string `json:"type"` Title string `json:"title"` }
Chat telegram data structure
type ConfigFile ¶
type ConfigFile struct { CertPath string `json:"cert_path"` KeyPath string `json:"key_path"` URL string `json:"url"` Endpoint string `json:"endpoint"` BotToken string `json:"bot_token"` Port string `json:"port"` GroupHandle string `json:"group_handle"` }
ConfigFile represents the structure of a configuration file
func CheckConfigFile ¶
func CheckConfigFile() (ConfigFile, error)
CheckConfigFile checks for presence of the config file, then proceeds to its parsing and validation
func (*ConfigFile) DecodeConfigFile ¶
func (c *ConfigFile) DecodeConfigFile(r io.Reader) error
DecodeConfigFile decodes a JSON configuration file into a ConfigFile
type GeneralReply ¶
type GeneralReply struct { Ok bool `json:"ok"` ErrorCode int `json:"error_code"` Description string `json:"description"` Result Chat `json:"result"` }
GeneralReply is any general telegram reply
type JSONData ¶
type JSONData interface {
DecodeJSON(r io.ReadCloser) error
}
JSONData represents everything that can be decoded to some struct
type Message ¶
type Message struct { MessageID int `json:"message_id"` From User `json:"from"` Chat Chat `json:"chat"` Date int `json:"date"` Text string `json:"text"` }
Message telegram object data structure
type Session ¶
type Session struct { Token string Port string Endpoint string URL string Configuration ConfigFile ChatID int GroupHandle string }
Session is a Telegram bot session
func (*Session) GetGroupUniqueID ¶
GetGroupUniqueID returns the unique identifier for a given group handle
func (*Session) PrintBotInformations ¶
PrintBotInformations prints some informations about the Bot the session represents
func (*Session) SetupWebHook ¶
SetupWebHook setup the Telegram webhook for the running server
type TelegramObject ¶
TelegramObject "Update" message model
func (*TelegramObject) DecodeJSON ¶
func (t *TelegramObject) DecodeJSON(r io.ReadCloser) error
DecodeJSON decodes some JSON into a TelegramObject
func (*TelegramObject) ReplyBackToChat ¶
func (t *TelegramObject) ReplyBackToChat(c string) error
ReplyBackToChat replies to the chat referred by Message.Chat.ID
type User ¶
type User struct { ID int `json:"id"` FirstName string `json:"first_name"` LastName string `json:"last_name"` Username string `json:"username"` }
User telegram object data struct
func (*User) DecodeJSON ¶
func (u *User) DecodeJSON(r io.ReadCloser) error
DecodeJSON decodes some JSON into a User