driver

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2022 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package driver 函数调用式驱动, 用于 gocqzbp

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterServer

func RegisterServer(r func(string, func(CQBot)))

RegisterServer 传入注册 CQBot 函数 如 go-cq 的 servers.RegisterCustom(name string, proc func(*coolq.CQBot))

Types

type CQBot

type CQBot interface {
	// OnEventPush 注册事件上报函数
	OnEventPush(func(e Event))
}

CQBot ...

type Caller

type Caller interface {
	// Call specific API
	Call(action string, para string) MSG
}

Caller ...

type Event

type Event interface {
	// JSONBytes return bytes of json by lazy marshalling.
	JSONBytes() []byte
	// JSONBytes return raw event msg.
	RawMSG() MSG
}

Event ...

type FCClient

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

FCClient Funcall Client

func NewFuncallClient

func NewFuncallClient(name string, newcaller func(CQBot) Caller, init func(*FCClient)) *FCClient

NewFuncallClient ...

func (*FCClient) CallApi

func (f *FCClient) CallApi(req zero.APIRequest) (zero.APIResponse, error)

CallApi 发送请求 nolint: stylecheck, revive

func (*FCClient) Connect

func (f *FCClient) Connect()

Connect 连接服务端

func (*FCClient) Listen

func (f *FCClient) Listen(handler func([]byte, zero.APICaller))

Listen 开始监听事件

func (*FCClient) SelfID

func (f *FCClient) SelfID() int64

SelfID 获得 bot qq 号

type MSG

type MSG = map[string]interface{}

MSG 消息Map

Jump to

Keyboard shortcuts

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