utils

package
v0.0.0-...-2bb5782 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: GPL-3.0 Imports: 29 Imported by: 0

Documentation

Overview

Package utils ARK Message model, Now work yet.

Package utils For MAIMAI | CHUN SQL DATABASE, SAVED AS USERNAME => USER UINT ID.

Package utils Transform => Make Image To Local Proxy Server, send Link.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Average

func Average(numbers []int) float64

Average sum all the numbers and divide by the length of the list.

func BindUserGenaralInfo

func BindUserGenaralInfo(userid uint64, username string) error

func BreakWords

func BreakWords(getSongName string, breakerCount float64) string

BreakWords Reduce the length of strings, if out of range, use ".." instead.

func DownloadImage

func DownloadImage(url string) (image.Image, error)

DownloadImage Simple Downloader.

func DrawBorderSimple

func DrawBorderSimple(page *gg.Context, s string, x float64, y float64, inlineRGB color.Color, reverse bool)

DrawBorderSimple Simple Usage of draw Border

func DrawBorderString

func DrawBorderString(page *gg.Context, s string, size int, x float64, y float64, ax float64, ay float64, inlineRGB color.Color, outlineRGB color.Color)

DrawBorderString GG Package Not support The string render, so I write this (^^)

func GetAverageColorAndMakeAdjust

func GetAverageColorAndMakeAdjust(image image.Image) (int, int, int)

GetAverageColorAndMakeAdjust different from k-means algorithm,it uses origin plugin's algorithm.(Reduce the cost of average color usage.)

func GetBotSelfImage

func GetBotSelfImage(ctx *nano.Ctx) image.Image

GetBotSelfImage Get User's Avatar from QGuild, Return Raw Image.

func GetUserAvatar

func GetUserAvatar(ctx *nano.Ctx) image.Image

GetUserAvatar Get User's Avatar from QGuild, Return Raw Image.

func GetUserInfoName

func GetUserInfoName(ctx *nano.Ctx) string

GetUserInfoName Get Info Name, for it can satisfy QQ Onebot Code here.

func ImageToTransform

func ImageToTransform(contentName string, images image.Image) string

func InitDataBase

func InitDataBase() error

func InitUserWalletDataBase

func InitUserWalletDataBase()

func InsertUserDataModifier

func InsertUserDataModifier(userData MaiStructSQL) error

func IsDark

func IsDark(rgb color.RGBA) bool

IsDark judge which font color I prefer to use (black or white)

func LimitByUser

func LimitByUser(ctx *nano.Ctx) *rate.Limiter

LimitByUser 默认限速器 每 10s 5次触发

按 发送者 限制

func LoadFontFace

func LoadFontFace(filePath string, size float64) font.Face

LoadFontFace load font face once before running, to work it quickly and save memory.

func LoadPictureWithResize

func LoadPictureWithResize(link string, w int, h int) image.Image

LoadPictureWithResize Load Picture

func MessageArkSender

func MessageArkSender(ctx *nano.Ctx, Tosender bool, ark *nano.MessageArk)

MessageArkSender User Should return ARK MESSAGE TYPE.

func ModifyTotalAwakenFunction

func ModifyTotalAwakenFunction(fixedUsage TotalCountFunction)

func ModifyUserAwakenFunction

func ModifyUserAwakenFunction(fixedUsage AwakenFunction)

func ModifyUserCoinFunction

func ModifyUserCoinFunction(fixedUsage CoinFunction)

func RandSenderPerDayN

func RandSenderPerDayN(uid int64, n int) int

RandSenderPerDayN 每个用户每天随机数

func ResLoader

func ResLoader(plugin string) string

ResLoader Only refer To loader Path here, no reader.

func ResReader

func ResReader(plugin string, insertDataFile string) (err bool, dataByte []byte)

ResReader Read refer Files here, return status and bytes

func Resize

func Resize(image image.Image, w int, h int) image.Image

Resize Image width height

func ReturnFontLocation

func ReturnFontLocation() string

ReturnFontLocation Return Font Location.

func ReturnLucyMainDataIndex

func ReturnLucyMainDataIndex(pluginName string) string

ReturnLucyMainDataIndex Lucy's main Path here.

func SaveImage

func SaveImage(img image.Image, path string)

SaveImage Save Cover Chun | Maimai

func SendArkCoverWithText

func SendArkCoverWithText(ctx *nano.Ctx, Tosender bool, image string, title string, content string, url ...string)

func SendArkTextWithSmallerImage

func SendArkTextWithSmallerImage(ctx *nano.Ctx, toSender bool, image2 string, title string, content string, url ...string)

func SplitChineseString

func SplitChineseString(s string, length int) []string

SplitChineseString Split Chinese type chart, Used In maimai | CHUN Render.

func SplitCommandTo

func SplitCommandTo(raw string, setCommandStopper int) (splitCommandLen int, splitInfo []string)

SplitCommandTo Split Command and Adjust To.

func TransformLink(contentPlace string) string

func UploadedCleaner

func UploadedCleaner()

Types

type AwakenFunction

type AwakenFunction struct {
	UserID     uint64 `db:"userid"` // UserID For here.
	AwakenTime int64  `db:"awaken"` // AwakenTime is for int64 UNIX.
	SignDay    string `db:"sign"`   // SignDay Is for user to check today is signed.
}

AwakenFunction Use for Sign Function.

func QueryUserAwakenFunction

func QueryUserAwakenFunction(queryID uint64) AwakenFunction

type CoinFunction

type CoinFunction struct {
	UserID uint64 `db:"userid"` // due to qq guild use longer id uint so change it.
	Coin   int64  `db:"coins"`  // to return user real token.
	Status bool   `db:"status"` // check if user use protect mode or not.
}

func QueryUserCoinsFunction

func QueryUserCoinsFunction(queryID uint64) CoinFunction

type GeneralUserdatabase

type GeneralUserdatabase struct {
	UserID   uint64 `db:"userid"`   // userID
	UserName string `db:"username"` // UserName
}

GeneralUserdatabase For DivingFish Service

func QueryUserGeneralInfo

func QueryUserGeneralInfo(userid uint64) GeneralUserdatabase

type MaiStructSQL

type MaiStructSQL struct {
	UserID     uint64 `db:"userid"` // userID
	Plate      string `db:"plate"`  // plate
	Background string `db:"bg"`     // bg
}

func QueryUserbaseMaiData

func QueryUserbaseMaiData(userid uint64) MaiStructSQL

type TotalCountFunction

type TotalCountFunction struct {
	TimeDay string `db:"time"`  // TimeDay Use "YYYYMMDD"
	Count   int64  `db:"Count"` // Count Count This Day How Many Users Logined.
}

func QueryTotalAwakenFunction

func QueryTotalAwakenFunction() TotalCountFunction

Jump to

Keyboard shortcuts

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