Documentation ¶
Index ¶
- Variables
- func BuildCardMessageCols(titleK, titleV string, kvMap map[string]interface{}) (res []interface{}, err error)
- func CheckIsAdmin(userID string) (isAdmin bool)
- func ForDebug(test ...interface{})
- func GetAdminLevel(userID string) int
- func GetChannnelInfo(channelID string) (channelInfo *khl.Channel, err error)
- func GetCommandWithParameters(rawCommand string) (command string, params []string)
- func GetCurrentTime() (localTime string)
- func GetDbConnection() *gorm.DB
- func GetGuildInfo(guildID string) (guildInfo *khl.Guild, err error)
- func GetOutBoundIP() (ip string, err error)
- func GetUserInfo(userID, guildID string) (userInfo *khl.User, err error)
- func InitGlowSansSCFontType()
- func InitLogger()
- func IsInSlice(target string, slice []string) bool
- func MustAtoI(str string) int
- func SendMessage(targetID, QuoteID, authorID string, message string)
- func SendMessageTemp(targetID, QuoteID, authorID string, message string)
- func Struct2Map(obj interface{}) map[string]interface{}
- func UploadFileToCos(filePath string) (linkURL string, err error)
- type Administrator
- type ChannelLog
- type CommandInfo
- type ErrorCollector
Constants ¶
This section is empty.
Variables ¶
var ( COSSecretID = os.Getenv("COS_SECRET_ID") COSSecretKey = os.Getenv("COS_SECRET_KEY") COSBaseURL = os.Getenv("COS_BASE_URL") COSBucketRegionURL = os.Getenv("COS_BUCKET_REGION_URL") )
var cosBucket = "kevinmatt-1303917904"
var ( ZapLogger *zaplog.ZapLogger SugerLogger *zaplog.ZapLoggerSugar )
var ZapLog日志变量
var GlowSansSC *truetype.Font
GlowSansSC 字体类型,未来荧黑
Functions ¶
func BuildCardMessageCols ¶ added in v0.0.5
func BuildCardMessageCols(titleK, titleV string, kvMap map[string]interface{}) (res []interface{}, err error)
BuildCardMessageCols 创建卡片消息的列
func GetChannnelInfo ¶ added in v0.0.5
GetChannnelInfo 获取频道信息
@param channelID @return channelInfo @return err
func GetCommandWithParameters ¶ added in v1.0.1
GetCommandWithParameters 获取命令及参数
@param rawCommand @return command @return params
func GetGuildInfo ¶ added in v0.0.5
GetGuildInfo 获取公会信息
@param guildID @return guildInfo @return err
func InitGlowSansSCFontType ¶ added in v1.0.1
func InitGlowSansSCFontType()
InitGlowSansSCFontType 初始化字体类型
func SendMessage ¶ added in v1.0.1
SendMessage 发送消息
@param targetID 目标ID @param QuoteID 引用ID @param authorID 作者ID @param err 错误信息
func SendMessageTemp ¶ added in v1.0.1
SendMessageTemp 发送消息
@param targetID 目标ID @param QuoteID 引用ID @param authorID 作者ID @param err 错误信息
func Struct2Map ¶ added in v0.0.5
func Struct2Map(obj interface{}) map[string]interface{}
Struct2Map 将结构体转换为map
@param obj @return map
func UploadFileToCos ¶ added in v1.0.1
UploadFileToCos 将文件上传到cos
Types ¶
type Administrator ¶ added in v1.0.1
type Administrator struct { gorm.Model UserID int64 `json:"user_id"` UserName string `json:"user_name"` Level int64 `json:"level"` }
Administrator is the struct of administrator
type ChannelLog ¶ added in v1.0.1
type ChannelLog struct { UserID string `json:"user_id"` UserName string `json:"user_name"` ChannelID string `json:"channel_id"` ChannelName string `json:"channel_name"` JoinedTime time.Time `json:"joined_time"` LeftTime time.Time `json:"left_time"` ISUpdate bool `json:"is_update"` }
ChannelLog is the struct of channel log
func (*ChannelLog) AddJoinedRecord ¶ added in v1.0.1
func (cl *ChannelLog) AddJoinedRecord() error
AddJoinedRecord 添加加入记录
@receiver cl @return error
func (*ChannelLog) UpdateLeftTime ¶ added in v1.0.1
func (cl *ChannelLog) UpdateLeftTime() error
UpdateLeftTime 更新离开时间
@receiver cl @return error
type CommandInfo ¶ added in v1.0.1
type CommandInfo struct { CommandName string `json:"command_name" gorm:"primaryKey;autoIncrement:false"` CommandDesc string `json:"command_desc"` CommandParamLen int `json:"command_param_len"` CommandType string `json:"command_type"` CreatedAt time.Time `json:"created_at" gorm:"autoCreateTime"` UpdatedAt time.Time `json:"updated_at" gorm:"autoUpdateTime"` }
CommandInfo is the struct of command info
func GetCommandInfo ¶ added in v1.0.1
func GetCommandInfo(command string) (commandInfoList []*CommandInfo, err error)
GetCommandInfo 获取命令信息
@param command @return info
func GetCommandInfoWithOpt ¶ added in v1.0.1
func GetCommandInfoWithOpt(optionf string) (commandInfoList []*CommandInfo, err error)
GetCommandInfoWithOpt 获取命令信息
@param option @return info
type ErrorCollector ¶ added in v1.0.1
type ErrorCollector []*error
ErrorCollector is a function that collects errors and returns the collected errors.
func (ErrorCollector) Collect ¶ added in v1.0.1
func (ec ErrorCollector) Collect(err error)
Collect adds an error to the collector.
@receiver ec @param err
func (ErrorCollector) Error ¶ added in v1.0.1
func (ec ErrorCollector) Error() string
Error is a wrapper for the error type that implements the ErrorCollector interface.
@receiver ec @return string
func (ErrorCollector) Errorf ¶ added in v1.0.1
func (ec ErrorCollector) Errorf(format string, args ...interface{})
Errorf is a wrapper for the error type that implements the ErrorCollector interface.
@receiver ec @param format @param args
func (ErrorCollector) GenErr ¶ added in v1.0.1
func (ec ErrorCollector) GenErr() error
GenErr is a wrapper for the error type that implements the ErrorCollector interface.
@receiver ec @return error
func (ErrorCollector) NoError ¶ added in v1.0.1
func (ec ErrorCollector) NoError() bool
NoError is a wrapper for the error type that implements the ErrorCollector interface.
@receiver ec @return bool
func (ErrorCollector) String ¶ added in v1.0.1
func (ec ErrorCollector) String() string
String is a wrapper for the string type that implements the ErrorCollector interface.
@receiver ec @return string