Documentation
¶
Index ¶
- Variables
- func AddressORNil[P any, T *P](input T) P
- func BuildCardMessage(theme, size, title, quoteID string, span any, modules ...any) (cardMessageStr string, err error)
- func BuildCardMessageCols(titleK, titleV string, kvMap map[string]any) (res []any, err error)
- func BuildURL(jsonURL string) string
- func CollectPanic(ctx context.Context, kookCtx interface{}, TargetID, QuoteID, UserID string)
- func EpoMil2DateStr(epoMil string) string
- func ExtractLyrics(lyric string) (s string, err error)
- func ForDebug(test ...any)
- func ForceMarshalJSON(v interface{}) string
- func GenerateTraceButton(traceInfo string) (b kook.CardMessageElementButton)
- func GenerateTraceButtonSection(traceInfo string) kook.CardMessageSection
- func GetChannnelInfo(channelID string) (channelInfo *kook.Channel, err error)
- func GetCommandWithParameters(rawCommand string) (command string, params []string)
- func GetCurrentFunc() string
- func GetCurrentTime() (localTime string)
- func GetEnvWithDefault(envStr, defaultValue string) string
- func GetFileMD5(reader io.Reader) (string, error)
- func GetFuncFromInstance(ctxFunc any) string
- func GetGuildIDFromChannelID(channelID string) (GuildID string)
- func GetGuildInfo(guildID string) (guildInfo *kook.Guild, err error)
- func GetIpv4() (ip string, err error)
- func GetIpv6() (ip string, err error)
- func GetOutBoundIP() (ip string, err error)
- func GetPubIP() (ipv4, ipv6 string, err error)
- func GetReceieverEmailList(dbConn *gorm.DB)
- func GetTimeCost(startTime time.Time, function string)
- func GetUserInfo(userID, guildID string) (userInfo *kook.User, err error)
- func InSlice[T comparable](slice []T, tgt T) bool
- func InitGlowSansSCFontType()
- func IsInSlice(target string, slice []string) bool
- func MustAtoI(str string) int
- func MustMashal(input any) string
- func MustUnmarshallString[T any](s string) *T
- func Probability(p float64) bool
- func Reconnect() (err error)
- func RegexpMatch(str, pattern string) bool
- func RemovePostStyle(content string) (res string)
- func ResizeIMGFromReader(ctx context.Context, r io.ReadCloser) (output []byte)
- func RunFuncName() string
- func SampleSlice[T any](slices []T) T
- func SendEmail(Subject string, Body string)
- func SendErrorMessageWithTitle(targetID, QuoteID, authorID, message, title string, ctx context.Context)
- func SendMessage(targetID, QuoteID, authorID string, message string)
- func SendMessageTemp(targetID, QuoteID, authorID, newMsg string)
- func SendMessageTempAndDelete(targetID, QuoteID, authorID, newMsg string)
- func SendMessageWithTitle(targetID, QuoteID, authorID, message, title string, ctx context.Context) (msgID string)
- func SendQRCodeMail(qrimg string) error
- func Struct2Map(obj any) map[string]any
- func UnmarshallString[T any](s string) (*T, error)
- func UnmarshallStringPre[T any](s string, val *T) error
- func UploadFileToCos(filePath string) (linkURL string, err error)
- type ErrorCollector
- func (ec *ErrorCollector) CheckError() error
- func (ec *ErrorCollector) Collect(err error)
- func (ec *ErrorCollector) Error() string
- func (ec *ErrorCollector) Errorf(format string, args ...interface{})
- func (ec *ErrorCollector) GenErr() error
- func (ec *ErrorCollector) NoError() bool
- func (ec *ErrorCollector) String() string
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 MCounter = prometheus.NewHistogramVec(prometheus.HistogramOpts{ Name: "func_time_cost_seconds", ConstLabels: map[string]string{}, Buckets: []float64{}, }, []string{"func_name"})
var MicrosoftYaHei *truetype.Font
MicrosoftYaHei 字体类型,未来荧黑
Functions ¶
func AddressORNil ¶ added in v1.0.2
func AddressORNil[P any, T *P](input T) P
func BuildCardMessage ¶ added in v1.0.2
func BuildCardMessage(theme, size, title, quoteID string, span any, modules ...any) (cardMessageStr string, err error)
BuildCardMessage 1
@return string
func BuildCardMessageCols ¶ added in v0.0.5
BuildCardMessageCols 创建卡片消息的列
func CollectPanic ¶ added in v1.0.2
CollectPanic is the function to collect panic
func EpoMil2DateStr ¶ added in v1.0.2
func ExtractLyrics ¶ added in v1.0.2
func ForceMarshalJSON ¶ added in v1.0.2
func ForceMarshalJSON(v interface{}) string
ForceMarshalJSON is the function to force marshal json
@param v @return string
func GenerateTraceButton ¶ added in v1.0.2
func GenerateTraceButton(traceInfo string) (b kook.CardMessageElementButton)
func GenerateTraceButtonSection ¶ added in v1.0.2
func GenerateTraceButtonSection(traceInfo string) kook.CardMessageSection
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 GetEnvWithDefault ¶ added in v1.0.2
func GetGuildIDFromChannelID ¶ added in v1.0.2
GetGuildIDFromChannelID 通过ChannelID获取GuildID
@param channelID @return GuildID
func GetGuildInfo ¶ added in v0.0.5
GetGuildInfo 获取公会信息
@param guildID @return guildInfo @return err
func GetReceieverEmailList ¶ added in v1.0.2
GetReceieverEmailList is the function to get recevier email list
func InSlice ¶ added in v1.0.2
func InSlice[T comparable](slice []T, tgt T) bool
func InitGlowSansSCFontType ¶ added in v1.0.1
func InitGlowSansSCFontType()
InitGlowSansSCFontType 初始化字体类型
func MustMashal ¶ added in v1.0.2
func MustUnmarshallString ¶ added in v1.0.2
func Probability ¶ added in v1.0.2
Probability returns true with the given probability p (0.0 to 1.0).
func RegexpMatch ¶ added in v1.0.2
func RemovePostStyle ¶ added in v1.0.2
func ResizeIMGFromReader ¶ added in v1.0.2
func ResizeIMGFromReader(ctx context.Context, r io.ReadCloser) (output []byte)
func RunFuncName ¶ added in v1.0.2
func RunFuncName() string
func SampleSlice ¶ added in v1.0.2
func SampleSlice[T any](slices []T) T
func SendErrorMessageWithTitle ¶ added in v1.0.2
func SendErrorMessageWithTitle(targetID, QuoteID, authorID, message, title string, ctx context.Context)
SendErrorMessageWithTitle 发送消息
@param targetID 目标ID @param QuoteID 引用ID @param authorID 作者ID @param message
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
func SendMessageTemp(targetID, QuoteID, authorID, newMsg string)
SendMessageTemp 发送消息
@param targetID 目标ID @param QuoteID 引用ID @param authorID 作者ID @param err 错误信息
func SendMessageTempAndDelete ¶ added in v1.0.2
func SendMessageTempAndDelete(targetID, QuoteID, authorID, newMsg string)
SendMessageTempAndDelete 1
@param targetID @param QuoteID @param authorID @param message
func SendMessageWithTitle ¶ added in v1.0.2
func SendQRCodeMail ¶ added in v1.0.2
SendQRCodeMail is the function to send QRCode mail
@param qrimg @return error
func UnmarshallString ¶ added in v1.0.2
func UnmarshallStringPre ¶ added in v1.0.2
func UploadFileToCos ¶ added in v1.0.1
UploadFileToCos 将文件上传到cos
Types ¶
type ErrorCollector ¶ added in v1.0.1
type ErrorCollector []*error
*ErrorCollector is a function that collects errors and returns the collected errors.
func (*ErrorCollector) CheckError ¶ added in v1.0.2
func (ec *ErrorCollector) CheckError() error
CheckError is a wrapper for the error type that implements the *ErrorCollector interface.
@receiver ec @return error
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