plugin

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: May 3, 2023 License: MIT Imports: 37 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var M = Manager{
	// contains filtered or unexported fields
}

Functions

func AddAutoLoadPlugin added in v0.0.4

func AddAutoLoadPlugin(name string) error

func GetPluginInfo

func GetPluginInfo(pluginName string) (*meta.PluginMeta, error)

func IsAdmin

func IsAdmin(uin int64) bool

func RemoveAutoLoadPlugin added in v0.0.4

func RemoveAutoLoadPlugin(name string) error

Types

type AutoLoadPluginCfg added in v0.0.4

type AutoLoadPluginCfg struct {
	PluginName   string `mapstructure:"pluginname"`
	PluginSha256 string `mapstructure:"pluginsha256"`
}

func GetAutoLoadPlugins added in v0.0.4

func GetAutoLoadPlugins() []AutoLoadPluginCfg

type Manager

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

func (*Manager) CloseAllPlugin

func (m *Manager) CloseAllPlugin(ctx context.Context)

func (*Manager) GetAllPlugins

func (m *Manager) GetAllPlugins() map[string]*Plugin

func (*Manager) GetPlugin

func (m *Manager) GetPlugin(pluginName string) (*Plugin, error)

func (*Manager) LoadPlugin

func (m *Manager) LoadPlugin(ctx context.Context, pluginPath string) error

func (*Manager) LoadPluginWithSha256 added in v0.0.4

func (m *Manager) LoadPluginWithSha256(ctx context.Context, pluginInfo AutoLoadPluginCfg) error

LoadPluginWithSha256 自动加载时使用

func (*Manager) OnGroupMsgAdmin

func (m *Manager) OnGroupMsgAdmin(ctx context.Context, event events.IEvent) bool

func (*Manager) OnGroupMsgEvent

func (m *Manager) OnGroupMsgEvent(ctx context.Context, event events.IEvent)

func (*Manager) UnloadPlugin

func (m *Manager) UnloadPlugin(ctx context.Context, pluginName string) error

type Plugin

type Plugin struct {
	Meta meta.PluginMeta
	// contains filtered or unexported fields
}

func (*Plugin) Http

func (p *Plugin) Http(ctx context.Context, request *proto.HttpReq) (*proto.HttpRes, error)

func (*Plugin) LockEvent

func (p *Plugin) LockEvent(f func())

func (*Plugin) Log

func (p *Plugin) Log(ctx context.Context, req *proto.LogReq) (*emptypb.Empty, error)

func (*Plugin) RegisterCronJob

func (p *Plugin) RegisterCronJob(ctx context.Context, job *proto.CronJob) (*emptypb.Empty, error)

func (*Plugin) RemoteCall

func (p *Plugin) RemoteCall(ctx context.Context, req *proto.RemoteCallReq) (*proto.RemoteCallReply, error)

func (*Plugin) RemoveCronJob

func (p *Plugin) RemoveCronJob(ctx context.Context, job *proto.CronJob) (*emptypb.Empty, error)

func (*Plugin) SendFriendMsg

func (p *Plugin) SendFriendMsg(ctx context.Context, request *proto.MsgReq) (*proto.SendReply, error)

func (*Plugin) SendGroupMsg

func (p *Plugin) SendGroupMsg(ctx context.Context, request *proto.MsgReq) (*proto.SendReply, error)

func (*Plugin) SendPrivateMsg

func (p *Plugin) SendPrivateMsg(ctx context.Context, request *proto.MsgReq) (*proto.SendReply, error)

func (*Plugin) Upload

func (p *Plugin) Upload(ctx context.Context, uploadReq *proto.UploadReq) (*proto.UploadReply, error)

type PluginEvent

type PluginEvent interface {
	Close(ctx context.Context) error
	proto.Event
}

Directories

Path Synopsis
S
cmd

Jump to

Keyboard shortcuts

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