utils

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2021 License: AGPL-3.0 Imports: 21 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CallerPackageName

func CallerPackageName(skipPkgName string) string

func CheckDetailType

func CheckDetailType(tp string) zero.Rule

CheckDetailType 检查事件DetailType(MessageType/NoticeType/RequestType)

func DirExists

func DirExists(path string) bool

DirExists 判断文件夹是否存在(若为文件,仍返回false)

func FileExists

func FileExists(path string) bool

FileExists 判断文件是否存在(若为文件夹,仍返回false)

func FormSetByStrings

func FormSetByStrings(slices ...[]string) map[string]struct{}

FormSetByStrings 将字符串切片形成Set

func GetArgs

func GetArgs(ctx *zero.Ctx) string

GetArgs 获取参数

func GetBotConfig

func GetBotConfig() zero.Config

GetBotConfig 获取机器人配置

func GetBotCtx

func GetBotCtx() *zero.Ctx

GetBotCtx 获取一个全局ctx

func GetBotNickname

func GetBotNickname() string

GetBotNickname 获取机器人昵称

func GetPkgNameByFunc

func GetPkgNameByFunc(fn interface{}) string

func GetQQAvatar

func GetQQAvatar(qq int64, size int) (io.Reader, error)

GetQQAvatar 快捷获取QQ头像

func GetQQGroupAvatar

func GetQQGroupAvatar(id int64, size int) (io.Reader, error)

GetQQGroupAvatar 快捷获取QQ群头像

func GoAndWait

func GoAndWait(handlers ...func() error) (err error)

func IsMessagePrimary

func IsMessagePrimary(ctx *zero.Ctx) bool

IsMessagePrimary 是否为私聊消息

func IsSameFunc

func IsSameFunc(fnL, fnR interface{}) bool

func IsSuperUser

func IsSuperUser(userID int64) bool

IsSuperUser userID是否为超级用户

func MakeDir

func MakeDir(path string) (string, error)

MakeDir 创建文件夹并返回文件夹绝对路径

func MakeDirWithMode

func MakeDirWithMode(path string, perm os.FileMode) (string, error)

MakeDirWithMode 依据文件夹权限创建文件夹并返回文件夹绝对路径

func MergeStringSlices

func MergeStringSlices(slices ...[]string) (res []string)

MergeStringSlices 合并多个字符串切片并去重、去除空字符串

func NewGormLogger

func NewGormLogger() *loggerGorm

func PathExists

func PathExists(path string) bool

PathExists 判断路径(包括文件与文件夹)是否存在

func PathJoin

func PathJoin(paths ...string) string

func PathSize

func PathSize(path string) uint64

PathSize 获取指定路径文件大小,若路径为文件夹,可能会导致效率较低

func RemovePath

func RemovePath(path string) error

func SendToSuper

func SendToSuper(message ...message.MessageSegment)

SendToSuper 将消息发送给所有后端的所有超级用户

Types

type LoggerCron

type LoggerCron struct{}

func NewCronLogger

func NewCronLogger() *LoggerCron

func (*LoggerCron) Error

func (l *LoggerCron) Error(err error, msg string, keysAndValues ...interface{})

func (*LoggerCron) Info

func (l *LoggerCron) Info(msg string, keysAndValues ...interface{})

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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