global

package
v0.9.27 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2020 License: AGPL-3.0 Imports: 22 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	IMAGE_PATH = path.Join("data", "images")
	VOICE_PATH = path.Join("data", "voices")
	VIDEO_PATH = path.Join("data", "videos")
	CACHE_PATH = path.Join("data", "cache")

	HEADER_AMR  = []byte("#!AMR")
	HEADER_SILK = []byte("\x02#!SILK_V3")
)
View Source
var EventFilter = new(Filter)

Functions

func BootFilter added in v0.9.25

func BootFilter()

func Check

func Check(err error)

func DelFile added in v0.9.27

func DelFile(path string) bool

func EnsureBool added in v0.9.20

func EnsureBool(p interface{}, defaultVal bool) bool

func FindFile added in v0.9.26

func FindFile(f, cache, PATH string) (data []byte, err error)

func GetBytes

func GetBytes(url string) ([]byte, error)

func InitLimiter added in v0.9.25

func InitLimiter(r float64, b int)

func IsAMRorSILK added in v0.9.20

func IsAMRorSILK(b []byte) bool

func NeteaseMusicSongInfo added in v0.9.22

func NeteaseMusicSongInfo(id string) (gjson.Result, error)

func PathExists

func PathExists(path string) bool

func QQMusicSongInfo added in v0.9.21

func QQMusicSongInfo(id string) (gjson.Result, error)

func RateLimit added in v0.9.25

func RateLimit(ctx context.Context)

func ReadAllText

func ReadAllText(path string) string

func WriteAllText

func WriteAllText(path, text string)

Types

type AndOperator added in v0.9.21

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

func (*AndOperator) Eval added in v0.9.21

func (andOperator *AndOperator) Eval(payload gjson.Result) bool

type CQHttpApiConfig

type CQHttpApiConfig struct {
	Host                         string `json:"host"`
	Port                         uint16 `json:"port"`
	UseHttp                      bool   `json:"use_http"`
	WSHost                       string `json:"ws_host"`
	WSPort                       uint16 `json:"ws_port"`
	UseWS                        bool   `json:"use_ws"`
	WSReverseUrl                 string `json:"ws_reverse_url"`
	WSReverseApiUrl              string `json:"ws_reverse_api_url"`
	WSReverseEventUrl            string `json:"ws_reverse_event_url"`
	WSReverseReconnectInterval   uint16 `json:"ws_reverse_reconnect_interval"`
	WSReverseReconnectOnCode1000 bool   `json:"ws_reverse_reconnect_on_code_1000"`
	UseWsReverse                 bool   `json:"use_ws_reverse"`
	PostUrl                      string `json:"post_url"`
	AccessToken                  string `json:"access_token"`
	Secret                       string `json:"secret"`
	PostMessageFormat            string `json:"post_message_format"`
}

type ContainsOperator added in v0.9.21

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

func (ContainsOperator) Eval added in v0.9.21

func (containsOperator ContainsOperator) Eval(payload gjson.Result) bool

type EqualOperator added in v0.9.21

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

func (EqualOperator) Eval added in v0.9.21

func (equalOperator EqualOperator) Eval(payload gjson.Result) bool

type Filter added in v0.9.21

type Filter interface {
	Eval(payload gjson.Result) bool
}

func Generate added in v0.9.25

func Generate(opName string, argument gjson.Result) Filter

type GoCQHttpConfig

type GoCQHttpConfig struct {
	Enabled  bool              `json:"enabled"`
	Host     string            `json:"host"`
	Port     uint16            `json:"port"`
	Timeout  int32             `json:"timeout"`
	PostUrls map[string]string `json:"post_urls"`
}

type GoCQReverseWebsocketConfig added in v0.9.2

type GoCQReverseWebsocketConfig struct {
	Enabled                  bool   `json:"enabled"`
	ReverseUrl               string `json:"reverse_url"`
	ReverseApiUrl            string `json:"reverse_api_url"`
	ReverseEventUrl          string `json:"reverse_event_url"`
	ReverseReconnectInterval uint16 `json:"reverse_reconnect_interval"`
}

type GoCQWebsocketConfig

type GoCQWebsocketConfig struct {
	Enabled bool   `json:"enabled"`
	Host    string `json:"host"`
	Port    uint16 `json:"port"`
}

type GoCqWebUi added in v0.9.27

type GoCqWebUi struct {
	Enabled   bool   `json:"enabled"`
	WebUiPort uint64 `json:"web_ui_port"`
	WebInput  bool   `json:"web_input"`
}

type InOperator added in v0.9.21

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

func (InOperator) Eval added in v0.9.21

func (inOperator InOperator) Eval(payload gjson.Result) bool

type JsonConfig

type JsonConfig struct {
	Uin               int64  `json:"uin"`
	Password          string `json:"password"`
	EncryptPassword   bool   `json:"encrypt_password"`
	PasswordEncrypted string `json:"password_encrypted"`
	EnableDB          bool   `json:"enable_db"`
	AccessToken       string `json:"access_token"`
	ReLogin           struct {
		Enabled         bool `json:"enabled"`
		ReLoginDelay    int  `json:"relogin_delay"`
		MaxReloginTimes uint `json:"max_relogin_times"`
	} `json:"relogin"`
	RateLimit struct {
		Enabled    bool    `json:"enabled"`
		Frequency  float64 `json:"frequency"`
		BucketSize int     `json:"bucket_size"`
	} `json:"_rate_limit"`
	IgnoreInvalidCQCode bool                          `json:"ignore_invalid_cqcode"`
	ForceFragmented     bool                          `json:"force_fragmented"`
	HeartbeatInterval   time.Duration                 `json:"heartbeat_interval"`
	HttpConfig          *GoCQHttpConfig               `json:"http_config"`
	WSConfig            *GoCQWebsocketConfig          `json:"ws_config"`
	ReverseServers      []*GoCQReverseWebsocketConfig `json:"ws_reverse_servers"`
	PostMessageFormat   string                        `json:"post_message_format"`
	Debug               bool                          `json:"debug"`
	LogLevel            string                        `json:"log_level"`
	WebUi               *GoCqWebUi                    `json:"web_ui"`
}

func DefaultConfig

func DefaultConfig() *JsonConfig

func Load

func Load(p string) *JsonConfig

func (*JsonConfig) Save

func (c *JsonConfig) Save(p string) error

type NotEqualOperator added in v0.9.21

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

func (NotEqualOperator) Eval added in v0.9.21

func (notEqualOperator NotEqualOperator) Eval(payload gjson.Result) bool

type NotOperator added in v0.9.21

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

func (NotOperator) Eval added in v0.9.21

func (notOperator NotOperator) Eval(payload gjson.Result) bool

type OperationNode added in v0.9.21

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

type OrOperator added in v0.9.21

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

func (OrOperator) Eval added in v0.9.21

func (orOperator OrOperator) Eval(payload gjson.Result) bool

type RegexOperator added in v0.9.21

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

func (RegexOperator) Eval added in v0.9.21

func (containsOperator RegexOperator) Eval(payload gjson.Result) bool

Jump to

Keyboard shortcuts

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