Documentation ¶
Index ¶
- Constants
- Variables
- type CommandOption
- type KeySet
- 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) 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) 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) 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 ¶
View Source
var ( ErrPermissionExist = errors.New("already exist") ErrPermissionNotExist = errors.New("not exist") )
Functions ¶
This section is empty.
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) 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) CheckGroupAdministrator ¶
func (c *StateManager) CheckGroupAdministrator(groupCode int64, caller int64) bool
func (*StateManager) CheckGroupCommandDisabled ¶
func (c *StateManager) CheckGroupCommandDisabled(groupCode int64, command string) bool
CheckGroupCommandDisabled check explicit disabled, must exist
func (*StateManager) CheckGroupCommandEnabled ¶
func (c *StateManager) CheckGroupCommandEnabled(groupCode int64, command string) bool
CheckGroupCommandEnabled 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) 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) 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.