control

package module
v1.2.3-add2 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2022 License: GPL-3.0 Imports: 18 Imported by: 361

README

zbpctrl

ZeroBot-Plugin 的控制库

Documentation

Overview

Package control 控制插件的启用与优先级等

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

func Delete(service string)

Delete 删除插件控制器,不会删除数据

func ForEach

func ForEach(iterator func(key string, manager *Control) bool)

ForEach iterates through managers.

func Register

func Register(service string, o *Options) *zero.Engine

Register 注册插件控制器

Types

type Control

type Control struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Control is to control the plugins.

func Lookup

func Lookup(service string) (*Control, bool)

Lookup returns a Manager by the service name, if not exist, it will return nil.

func (*Control) Ban

func (m *Control) Ban(uid, gid int64)

Ban 禁止某人在某群使用本插件

func (*Control) Disable

func (m *Control) Disable(groupID int64)

Disable disables a group to pass the Manager. groupID == 0 (ALL) will operate on all grps.

func (*Control) Enable

func (m *Control) Enable(groupID int64)

Enable enables a group to pass the Manager. groupID == 0 (ALL) will operate on all grps.

func (*Control) GetData

func (m *Control) GetData(gid int64) int64

GetData 获取某个群的 63 字节配置信息

func (*Control) Handler

func (m *Control) Handler(ctx *zero.Ctx) bool

Handler 返回 预处理器

func (*Control) IsBannedIn

func (m *Control) IsBannedIn(uid, gid int64) bool

IsBannedIn 某人是否在某群被 ban

func (*Control) IsEnabledIn

func (m *Control) IsEnabledIn(gid int64) bool

IsEnabledIn 开启群

func (*Control) Permit

func (m *Control) Permit(uid, gid int64)

Permit 允许某人在某群使用本插件

func (*Control) Reset

func (m *Control) Reset(groupID int64)

Reset resets the default config of a group. groupID == 0 (ALL) is not allowed.

func (*Control) SetData

func (m *Control) SetData(groupID int64, data int64) error

SetData 为某个群设置低 63 位配置数据

type Options

type Options struct {
	DisableOnDefault bool
	Help             string // 帮助文本信息
}

Options holds the optional parameters for the Manager.

Directories

Path Synopsis
Package webctrl 包含 webui 所需的所有内容
Package webctrl 包含 webui 所需的所有内容

Jump to

Keyboard shortcuts

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