Documentation ¶
Index ¶
- Constants
- Variables
- func IsPermissionError(err error) bool
- type CommandOption
- type KeySet
- func (k *KeySet) BlockListKey(keys ...interface{}) string
- func (k *KeySet) GlobalEnabledKey(keys ...interface{}) string
- func (k *KeySet) GroupEnabledKey(keys ...interface{}) string
- func (k *KeySet) GroupPermissionKey(keys ...interface{}) string
- func (k *KeySet) PermissionKey(keys ...interface{}) string
- type RequireOption
- type RoleType
- type StateManager
- func (c *StateManager) AddBlockList(caller int64, d time.Duration) error
- func (c *StateManager) CheckBlockList(caller int64) bool
- func (c *StateManager) CheckGlobalCommandDisabled(command string) bool
- func (c *StateManager) CheckGlobalCommandFunc(command string, f func(val string, exist bool) bool) bool
- func (c *StateManager) CheckGroupAdministrator(groupCode int64, caller int64) bool
- func (c *StateManager) CheckGroupCommandDisabled(groupCode int64, command string) bool
- func (c *StateManager) CheckGroupCommandEnabled(groupCode int64, command string) bool
- func (c *StateManager) CheckGroupCommandFunc(groupCode int64, command string, f func(val string, exist bool) bool) bool
- func (c *StateManager) CheckGroupCommandPermission(groupCode int64, caller int64, command string) bool
- func (c *StateManager) CheckGroupRole(groupCode int64, caller int64, role RoleType) bool
- func (c *StateManager) CheckNoAdmin() bool
- func (c *StateManager) CheckRole(caller int64, role RoleType) bool
- func (c *StateManager) DeleteBlockList(caller int64) error
- func (c *StateManager) DisableGroupCommand(groupCode int64, command string, opts ...CommandOption) error
- func (c *StateManager) EnableGroupCommand(groupCode int64, command string, opts ...CommandOption) error
- func (c *StateManager) FreshIndex()
- func (c *StateManager) GlobalDisableGroupCommand(command string, opts ...CommandOption) error
- func (c *StateManager) GlobalEnableGroupCommand(command string, opts ...CommandOption) error
- func (c *StateManager) GrantGroupRole(groupCode int64, target int64, role RoleType) error
- func (c *StateManager) GrantPermission(groupCode int64, target int64, command string) error
- func (c *StateManager) GrantRole(target int64, role RoleType) error
- func (c *StateManager) RemoveAllByGroup(groupCode int64) error
- func (c *StateManager) RequireAny(option ...RequireOption) bool
- func (c *StateManager) UngrantGroupRole(groupCode int64, target int64, role RoleType) error
- func (c *StateManager) UngrantPermission(groupCode int64, target int64, command string) error
- func (c *StateManager) UngrantRole(target int64, role RoleType) error
Constants ¶
View Source
const Disable = "disable"
View Source
const Enable = "enable"
Variables ¶
Functions ¶
func IsPermissionError ¶ added in v0.0.13
Types ¶
type CommandOption ¶
type CommandOption func(c *commandOption)
func ExpireOption ¶
func ExpireOption(d time.Duration) CommandOption
type KeySet ¶
type KeySet struct{}
func (*KeySet) BlockListKey ¶
func (*KeySet) GlobalEnabledKey ¶ added in v0.0.16
func (*KeySet) GroupEnabledKey ¶
func (*KeySet) GroupPermissionKey ¶
func (*KeySet) PermissionKey ¶
type RequireOption ¶
type RequireOption interface {
Validate(s *StateManager) bool
}
func AdminRoleRequireOption ¶
func AdminRoleRequireOption(uin int64) RequireOption
func GroupAdminRoleRequireOption ¶
func GroupAdminRoleRequireOption(groupCode int64, uin int64) RequireOption
func GroupCommandRequireOption ¶
func GroupCommandRequireOption(groupCode int64, uin int64, command string) RequireOption
func QQAdminRequireOption ¶
func QQAdminRequireOption(groupCode int64, uin int64) RequireOption
type StateManager ¶
func NewStateManager ¶
func NewStateManager() *StateManager
func (*StateManager) AddBlockList ¶
func (c *StateManager) AddBlockList(caller int64, d time.Duration) error
func (*StateManager) CheckBlockList ¶
func (c *StateManager) CheckBlockList(caller int64) bool
CheckBlockList return true if blocked
func (*StateManager) CheckGlobalCommandDisabled ¶ added in v0.0.16
func (c *StateManager) CheckGlobalCommandDisabled(command string) bool
func (*StateManager) CheckGlobalCommandFunc ¶ added in v0.0.16
func (*StateManager) CheckGroupAdministrator ¶
func (c *StateManager) CheckGroupAdministrator(groupCode int64, caller int64) bool
func (*StateManager) CheckGroupCommandDisabled ¶
func (c *StateManager) CheckGroupCommandDisabled(groupCode int64, command string) bool
CheckGroupCommandDisabled check global first, then check explicit disabled, must exist
func (*StateManager) CheckGroupCommandEnabled ¶
func (c *StateManager) CheckGroupCommandEnabled(groupCode int64, command string) bool
CheckGroupCommandEnabled check global first, check explicit enabled, must exist
func (*StateManager) CheckGroupCommandFunc ¶
func (*StateManager) CheckGroupCommandPermission ¶
func (c *StateManager) CheckGroupCommandPermission(groupCode int64, caller int64, command string) bool
func (*StateManager) CheckGroupRole ¶
func (c *StateManager) CheckGroupRole(groupCode int64, caller int64, role RoleType) bool
func (*StateManager) CheckNoAdmin ¶ added in v0.0.16
func (c *StateManager) CheckNoAdmin() bool
func (*StateManager) DeleteBlockList ¶
func (c *StateManager) DeleteBlockList(caller int64) error
func (*StateManager) DisableGroupCommand ¶
func (c *StateManager) DisableGroupCommand(groupCode int64, command string, opts ...CommandOption) error
func (*StateManager) EnableGroupCommand ¶
func (c *StateManager) EnableGroupCommand(groupCode int64, command string, opts ...CommandOption) error
func (*StateManager) FreshIndex ¶
func (c *StateManager) FreshIndex()
func (*StateManager) GlobalDisableGroupCommand ¶ added in v0.0.16
func (c *StateManager) GlobalDisableGroupCommand(command string, opts ...CommandOption) error
func (*StateManager) GlobalEnableGroupCommand ¶ added in v0.0.16
func (c *StateManager) GlobalEnableGroupCommand(command string, opts ...CommandOption) error
func (*StateManager) GrantGroupRole ¶
func (c *StateManager) GrantGroupRole(groupCode int64, target int64, role RoleType) error
func (*StateManager) GrantPermission ¶
func (c *StateManager) GrantPermission(groupCode int64, target int64, command string) error
func (*StateManager) GrantRole ¶
func (c *StateManager) GrantRole(target int64, role RoleType) error
func (*StateManager) RemoveAllByGroup ¶
func (c *StateManager) RemoveAllByGroup(groupCode int64) error
func (*StateManager) RequireAny ¶
func (c *StateManager) RequireAny(option ...RequireOption) bool
func (*StateManager) UngrantGroupRole ¶
func (c *StateManager) UngrantGroupRole(groupCode int64, target int64, role RoleType) error
func (*StateManager) UngrantPermission ¶
func (c *StateManager) UngrantPermission(groupCode int64, target int64, command string) error
func (*StateManager) UngrantRole ¶
func (c *StateManager) UngrantRole(target int64, role RoleType) error
Click to show internal directories.
Click to hide internal directories.