Documentation ¶
Overview ¶
Package ctxext zb context 扩展
Index ¶
- Variables
- func FakeSenderForwardNode(ctx *zero.Ctx, msgs ...message.MessageSegment) message.MessageSegment
- func LimitByGroup(ctx *zero.Ctx) *rate.Limiter
- func LimitByUser(ctx *zero.Ctx) *rate.Limiter
- func SetDefaultLimiterManagerParam(interval time.Duration, burst int)
- type LimiterManager
- type NoCtxGetMsg
- type NoCtxSendMsg
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultSingle = single.New( single.WithKeyFn(func(ctx *zero.Ctx) int64 { return ctx.Event.UserID }), single.WithPostFn[int64](func(ctx *zero.Ctx) { ctx.Send("您有操作正在执行, 请稍后再试!") }), )
DefaultSingle 默认反并发处理
按 qq 号反并发 并发时返回 "您有操作正在执行, 请稍后再试!"
Functions ¶
func FakeSenderForwardNode ¶
func FakeSenderForwardNode(ctx *zero.Ctx, msgs ...message.MessageSegment) message.MessageSegment
FakeSenderForwardNode ...
func SetDefaultLimiterManagerParam ¶
SetDefaultLimiterManagerParam 设置默认限速器参数
每 interval 时间 burst 次触发
Types ¶
type LimiterManager ¶
type LimiterManager struct {
// contains filtered or unexported fields
}
LimiterManager 自定义限速器管理
func NewLimiterManager ¶
func NewLimiterManager(interval time.Duration, burst int) (m LimiterManager)
NewLimiterManager 新限速器管理
func (LimiterManager) LimitByGroup ¶
func (m LimiterManager) LimitByGroup(ctx *zero.Ctx) *rate.Limiter
LimitByGroup 自定义限速器
按群号限制
func (LimiterManager) LimitByUser ¶
func (m LimiterManager) LimitByUser(ctx *zero.Ctx) *rate.Limiter
LimitByUser 自定义限速器
按 qq 号限制
type NoCtxGetMsg ¶
func GetFirstMessageInForward ¶
func GetFirstMessageInForward(ctx *zero.Ctx) NoCtxGetMsg
GetFirstMessageInForward ...
type NoCtxSendMsg ¶
func SendFakeForwardToGroup ¶
func SendFakeForwardToGroup(ctx *zero.Ctx, msgs ...message.MessageSegment) NoCtxSendMsg
SendFakeForwardToGroup ...
Click to show internal directories.
Click to hide internal directories.