types

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2023 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MinManager []Access = []Access{Owner, Manager}
View Source
var MinMember []Access = []Access{Owner, Manager, Super, Member}
View Source
var MinSuper []Access = []Access{Owner, Manager, Super}

Functions

func AccessContain

func AccessContain(access Access, access_list []Access) bool

func NewPluginList

func NewPluginList() iPluginList

Types

type Access

type Access string
const (
	Owner   Access = "Owner"
	Manager Access = "Manager"
	Super   Access = "Super"
	Member  Access = "Member"
	Guest   Access = "Guest"
)

type Command

type Command struct {
	Cmd         []string       `json:"cmd"`
	Description string         `json:"description"`
	Usage       string         `json:"usage"`
	Passed      bool           `json:"passed"`
	Disabled    bool           `json:"disabled"`
	Expires     float64        `json:"expires"`
	Insensitive bool           `json:"Insensitive"`
	Execute     CommandExecute `json:"execute"`
}

func (*Command) Exists

func (c *Command) Exists(cm string) bool

func (*Command) GetUsage

func (c *Command) GetUsage() string

func (Command) MarshalJSON

func (c Command) MarshalJSON() ([]byte, error)

func (*Command) SetDisabled

func (c *Command) SetDisabled()

func (*Command) SetEnable

func (c *Command) SetEnable()

type Hit

type Hit struct {
	Id      string `json:"id"`
	Appname string `json:"appname"`
	Command string `json:"command"`
	Hits    int    `json:"Hits"`
}

type IAuth

type IAuth interface {
	UserRemove(id string) (bool, error)
	UserAdd(user User, perm Permission) (bool, error)
	UserExists(id string) (User, error)
	UserList() ([]User, error)

	PermissionRemove(id string, access Access) (bool, error)
	PermissionAdd(perm Permission) (bool, error)

	ValidManyPermission(id string, access []Access) ([]Permission, bool)
	ValidPermission(id string, access Access) (Permission, bool)

	HitCommand(id, appname, command string) (Hit, error)
}

func NewAuthenticator

func NewAuthenticator(db *sql.DB) IAuth

type Permission

type Permission struct {
	Id      string    `json:"id"`
	Access  Access    `json:"access"`
	Issued  time.Time `json:"issued"`
	Expires time.Time `json:"expires"`
}

type Plugin

type Plugin struct {
	Name        string     `json:"name"`
	Description string     `json:"description"`
	Commands    []*Command `json:"commands"`
	Tags        []string   `json:"tags"`
	Permissions []string   `json:"permissions"`
	Disabled    bool       `json:"disabled"`
	Validate    Validator  `json:"validate"`
}

func (*Plugin) Call

func (p *Plugin) Call(i interface{}, a *whatsmeow.Client) []error

func (*Plugin) CommandAdd

func (p *Plugin) CommandAdd(cmd *Command) int

func (*Plugin) CommandAddMany

func (p *Plugin) CommandAddMany(cmds []*Command) int

func (*Plugin) CommandCopy

func (p *Plugin) CommandCopy(n string) *Command

func (*Plugin) SetDisabled

func (p *Plugin) SetDisabled()

func (*Plugin) SetEnable

func (p *Plugin) SetEnable()

type User

type User struct {
	Id        string `json:"id"`
	Submitter string `json:"submitter"`
	IsGroup   bool   `json:"isgroup"`
	Coins     int    `json:"coins"`
}

type Validator

type Validator func(interface{}, *whatsmeow.Client) (bool, error)

Jump to

Keyboard shortcuts

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