gram

package module
v0.0.0-...-1fd9370 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2018 License: MIT Imports: 5 Imported by: 0

README

gram GoDoc Go Report Card

This is just an API design yet, do not use it untill there is an actual release.

Goals

  • Provide a dead simple API.
  • Handle errors/invalid data gracefully for a smoother user experience.
  • Make it scalable and fault tolerant.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Button

type Button struct {
}

func NewButton

func NewButton() *Button

type ButtonGroup

type ButtonGroup []Button

type CmdArgs

type CmdArgs struct {
}

func (*CmdArgs) Get

func (c *CmdArgs) Get(out interface{}) error

type Context

type Context struct {
	context.Context
	ID      string
	ChatID  string
	Cmd     string
	CmdUser string
}

func GetContext

func GetContext(chatID string) *Context

func (*Context) Cancel

func (c *Context) Cancel()

func (*Context) CmdArgs

func (c *Context) CmdArgs() *CmdArgs

func (*Context) Get

func (c *Context) Get(out interface{}) error

func (*Context) Promp

func (c *Context) Promp(description string, button Button, otherButtons ...Button) error

func (*Context) Send

func (c *Context) Send(s string) error

func (*Context) SetKeyboard

func (c *Context) SetKeyboard(buttonGroup []ButtonGroup, otherButtonGroups ...[]ButtonGroup) error

func (*Context) ShowNotification

func (c *Context) ShowNotification(s string) error

func (*Context) Switch

func (c *Context) Switch(pipeline *Pipeline)

type Gram

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

func New

func New(ops ...Option) (*Gram, error)

func (*Gram) Attach

func (g *Gram) Attach(pipeline *Pipeline, otherPipelines ...*Pipeline)

func (*Gram) StartPooling

func (g *Gram) StartPooling() error

func (*Gram) StopPooling

func (g *Gram) StopPooling() error

func (*Gram) UpdateCommands

func (g *Gram) UpdateCommands() error

func (*Gram) WebhookHandler

func (g *Gram) WebhookHandler() http.Handler

type Option

type Option func(*Gram)

func BotOption

func BotOption(key string) Option

func EnableDistributedModeOption

func EnableDistributedModeOption() Option

func GracefulSendFuncOption

func GracefulSendFuncOption(func()) Option

func sleep or chan wait?

func GracefulSendOption

func GracefulSendOption() Option

func RedisOption

func RedisOption(addr, db string) Option

type Pipeline

type Pipeline struct {
}

func Any

func Any() *Pipeline

func Cmd

func Cmd(name, desc string) *Pipeline

func Step

func Step(func(*Context)) *Pipeline

func (*Pipeline) Step

func (p *Pipeline) Step(func(*Context)) *Pipeline

type StateDecoder

type StateDecoder interface {
	Decode(data []byte) error
}

type StateEncoder

type StateEncoder interface {
	Encode(data []byte) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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