impl

package
v1.1.25 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvMetric = "ENV_METRIC_%s"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Env

type Env struct {
	Disable atomic.Bool

	Metric *metric.Metric
	// contains filtered or unexported fields
}

func NewEnv

func NewEnv(p plugin.Plugin, customConf conf.CustomPluginConf, otherPlugins map[string]plugin.Plugin, envs map[string]any) *Env

func (*Env) Error

func (e *Env) Error(ctx *zero.Ctx, err error)

func (*Env) FilePath

func (e *Env) FilePath() (string, error)

func (*Env) Get

func (e *Env) Get(key string) any

func (*Env) GetConf

func (e *Env) GetConf(conf any) error

func (*Env) GetDB

func (e *Env) GetDB() (*gorm.DB, error)

func (*Env) GetPlugin

func (e *Env) GetPlugin(name string) (p plugin.Plugin, ok bool)

func (*Env) Groups

func (e *Env) Groups() plugin.Groups

func (*Env) IsDisable

func (e *Env) IsDisable() bool

IsDisable 判断是否禁用

func (*Env) MetricReport added in v1.1.1

func (e *Env) MetricReport() string

func (*Env) Set

func (e *Env) Set(key string, value any)

func (*Env) SuperUser

func (e *Env) SuperUser() plugin.Users

func (*Env) Toggle

func (e *Env) Toggle(b bool)

func (*Env) UseBot

func (e *Env) UseBot(h zero.Handler)

type EnvEngine

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

func NewEngine

func NewEngine(env *Env, e *zero.Engine) *EnvEngine

func (*EnvEngine) On

func (e *EnvEngine) On(typ string, rules ...zero.Rule) *zero.Matcher

func (*EnvEngine) OnCommand

func (e *EnvEngine) OnCommand(commands string, rules ...zero.Rule) *zero.Matcher

func (*EnvEngine) OnCommandGroup

func (e *EnvEngine) OnCommandGroup(commands []string, rules ...zero.Rule) *zero.Matcher

func (*EnvEngine) OnFullMatch

func (e *EnvEngine) OnFullMatch(src string, rules ...zero.Rule) *zero.Matcher

func (*EnvEngine) OnFullMatchGroup

func (e *EnvEngine) OnFullMatchGroup(src []string, rules ...zero.Rule) *zero.Matcher

func (*EnvEngine) OnKeyword

func (e *EnvEngine) OnKeyword(keyword string, rules ...zero.Rule) *zero.Matcher

func (*EnvEngine) OnKeywordGroup

func (e *EnvEngine) OnKeywordGroup(keywords []string, rules ...zero.Rule) *zero.Matcher

func (*EnvEngine) OnMessage

func (e *EnvEngine) OnMessage(rules ...zero.Rule) *zero.Matcher

func (*EnvEngine) OnMetaEvent

func (e *EnvEngine) OnMetaEvent(rules ...zero.Rule) *zero.Matcher

func (*EnvEngine) OnNotice

func (e *EnvEngine) OnNotice(rules ...zero.Rule) *zero.Matcher

func (*EnvEngine) OnPrefix

func (e *EnvEngine) OnPrefix(prefix string, rules ...zero.Rule) *zero.Matcher

func (*EnvEngine) OnPrefixGroup

func (e *EnvEngine) OnPrefixGroup(prefix []string, rules ...zero.Rule) *zero.Matcher

func (*EnvEngine) OnRegex

func (e *EnvEngine) OnRegex(regexPattern string, rules ...zero.Rule) *zero.Matcher

func (*EnvEngine) OnRequest

func (e *EnvEngine) OnRequest(rules ...zero.Rule) *zero.Matcher

func (*EnvEngine) OnShell

func (e *EnvEngine) OnShell(command string, model interface{}, rules ...zero.Rule) *zero.Matcher

func (*EnvEngine) OnSuffix

func (e *EnvEngine) OnSuffix(suffix string, rules ...zero.Rule) *zero.Matcher

func (*EnvEngine) OnSuffixGroup

func (e *EnvEngine) OnSuffixGroup(suffix []string, rules ...zero.Rule) *zero.Matcher

func (*EnvEngine) UseMidHandler

func (e *EnvEngine) UseMidHandler(rules ...zero.Rule)

func (*EnvEngine) UsePostHandler

func (e *EnvEngine) UsePostHandler(handler ...zero.Handler)

func (*EnvEngine) UsePreHandler

func (e *EnvEngine) UsePreHandler(rules ...zero.Rule)

type Groups

type Groups []int64

func (Groups) IsContains

func (g Groups) IsContains(groupId int64) bool

func (Groups) RangeGroup

func (g Groups) RangeGroup() iter.Seq[int64]

func (Groups) Rule

func (g Groups) Rule() zero.Rule

type GroupsWithEnv

type GroupsWithEnv struct {
	Groups
	// contains filtered or unexported fields
}

func NewGroupsWithEnv

func NewGroupsWithEnv(groups Groups, env *Env) *GroupsWithEnv

func (*GroupsWithEnv) Rule

func (g *GroupsWithEnv) Rule() zero.Rule

type UserWithEnv

type UserWithEnv struct {
	Users
	// contains filtered or unexported fields
}

func NewUserWithEnv

func NewUserWithEnv(users Users, env *Env) *UserWithEnv

func (*UserWithEnv) Rule

func (g *UserWithEnv) Rule() zero.Rule

type Users

type Users []int64

func (Users) IsContains

func (u Users) IsContains(userId int64) bool

func (Users) RangeUser

func (u Users) RangeUser() iter.Seq[int64]

func (Users) Rule

func (u Users) Rule() zero.Rule

Jump to

Keyboard shortcuts

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