jabot

package module
v0.0.0-...-a7efd26 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2020 License: MIT Imports: 17 Imported by: 0

README

jabot

golang 实现xmpp聊天机器人

Build Status GoDoc

使用

go get github.com/kjx98/jabot

主要模块

  • 登陆
  • 初始化信息
  • 获取通讯录
  • 发送信息
  • 获取自动回复内容

源码地址

https://github.com/kjx98/jabot

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Tuling Tuling `yaml:"tuling"`
	Jid    string
	Passwd string
	DefJid string
	Domain string
}

func NewConfig

func NewConfig(key string) Config

type Contact

type Contact struct {
	Jid          string
	Name         string
	NickName     string
	Group        []string
	Online       bool
	Subscription string
}

type HandlerFunc

type HandlerFunc func(args []string) string

HandleFunc type

used for RegisterHandle

type HookFunc

type HookFunc func(args string)

type Jabot

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

func NewJabot

func NewJabot(cfg *Config) (*Jabot, error)

func NewJabotConn

func NewJabotConn(talk *xmpp.Client) *Jabot

func (*Jabot) AddChat

func (w *Jabot) AddChat(jid string) error

func (*Jabot) Close

func (w *Jabot) Close() error

func (*Jabot) Connect

func (w *Jabot) Connect() error

func (*Jabot) Dail

func (w *Jabot) Dail() error

func (*Jabot) GetContacts

func (w *Jabot) GetContacts() []Contact

func (*Jabot) GetRoster

func (w *Jabot) GetRoster() error

func (*Jabot) IsConnected

func (w *Jabot) IsConnected() bool

func (*Jabot) Ping

func (w *Jabot) Ping() error

func (*Jabot) RawIQtime

func (c *Jabot) RawIQtime(from, to, id string) error

func (*Jabot) RawLast

func (c *Jabot) RawLast(from, to, id string, last int) error

func (*Jabot) RawLastNA

func (c *Jabot) RawLastNA(from, to, id string) error

func (*Jabot) RawVersion

func (c *Jabot) RawVersion(from, to, id, version, osName string) error

func (*Jabot) RegisterHandle

func (w *Jabot) RegisterHandle(cmd string, cmdFunc HandlerFunc) error

func (*Jabot) RegisterHook

func (w *Jabot) RegisterHook(hookStr string, hook HookFunc)

func (*Jabot) RegisterTimeCmd

func (w *Jabot) RegisterTimeCmd()

func (*Jabot) SendGroupMessage

func (w *Jabot) SendGroupMessage(message string, to string) error

func (*Jabot) SendMessage

func (w *Jabot) SendMessage(message string, to string) error

func (*Jabot) SetLogLevel

func (w *Jabot) SetLogLevel(l logging.Level)

SetLogLevel

logging.Level   from github.com/op/go-logging
type Menu struct {
	Name      string `json:"name"`
	Icon      string `json:"icon"`
	Info      string `json:"info"`
	DetailURL string `json:"detailurl"`
}

type News

type News struct {
	Article   string `json:"article"`
	Source    string `json:"source"`
	Icon      string `json:"icon"`
	DetailURL string `json:"detailurl"`
}

tuling

type Reply

type Reply struct {
	Code int         `json:"code"`
	Text string      `json:"text"` //100000
	URL  string      `json:"url"`  //200000
	List interface{} `json:"list"` //302000 []News 308000 []Menu
}

type Tuling

type Tuling struct {
	URL    string `yaml:"url"`
	KeyAPI string `yaml:"APIkey"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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