telegraphist: github.com/xamut/telegraphist Index | Files | Directories

package telegraphist

import "github.com/xamut/telegraphist"

Index

Package Files

server.go telegraphist.go

Constants

const (
    // DefaultBaseURL is endpoint URL to Telegram Bot API
    DefaultBaseURL string = "https://api.telegram.org/bot"
    // DefaultPort is port for serving the webhook
    DefaultPort int = 443
    // DefaultTimeout is period of time that will be allowed to wait a response
    DefaultTimeout time.Duration = 5 * time.Second
)

func NewClient Uses

func NewClient(config *ClientConfig) (*telegram.Client, error)

NewClient creates a new instance of API client with ClientConfig

func NewServer Uses

func NewServer(config *ServerConfig, handlers *map[string]func(update telegram.Update) error) error

NewServer create a new instance of the web server to process Telegram API webhook

type ClientConfig Uses

type ClientConfig struct {
    BaseURL  string
    BotToken string
    Timeout  time.Duration
}

ClientConfig represents settings of API client

type Logger Uses

type Logger interface {
    Printf(format string, v ...interface{})
}

type ServerConfig Uses

type ServerConfig struct {
    Debug       bool
    EnableHTTPS bool
    Logger      Logger
    Port        int
    Timeout     time.Duration
    Webhook     string
}

ServerConfig represents settings of the webhook server

Directories

PathSynopsis
telegram

Package telegraphist imports 11 packages (graph). Updated 2019-08-28. Refresh now. Tools for package owners.