utils

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2024 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	API_TIME_OUT_Second = 8
)

Variables

This section is empty.

Functions

func CheckPingBaseURL

func CheckPingBaseURL(baseURL string) (retBool bool)

自检openAPI服务是否正常运行

func DoDeleteToOpenAPI

func DoDeleteToOpenAPI(apiDomain, apiPath, apiToken string) (retByte []byte, err error)

func DoPostFormToOpenAPI

func DoPostFormToOpenAPI(apiDomain, apiPath, apiToken string, dataBody string) (retByte []byte, err error)

func DoPostJsonToOpenAPI

func DoPostJsonToOpenAPI(apiDomain, apiPath, apiToken string, req interface{}) (retByte []byte, err error)

func DoPubToOpenAPI

func DoPubToOpenAPI(apiDomain, apiPath, apiToken string) (retByte []byte, err error)

func FeedKeyworldCheck

func FeedKeyworldCheck(msgText, feedKeyworldFilter, feedKeyworldList string) (retText, retFilter string, retBool bool)

检查屏蔽关键词,关键词,存在屏蔽词(keyworldFilter) 返回false,存在订阅关键词(keyworldList)或无订阅关键词词 返回true

func FeedKeyworldReplace

func FeedKeyworldReplace(msgText, feedKeyworldReplace string) string

文案级关键词替换

func GetStringRuneN

func GetStringRuneN(textStr string, n int) (retText string)

截图字符串前N个字符内容

func Gzip

func Gzip(data []byte)

func JsonDecode

func JsonDecode(data string, inter interface{}) error

func JsonDecodeByte

func JsonDecodeByte(bytes []byte) map[string]interface{}

func JsonDecodeString

func JsonDecodeString(String string) map[string]interface{}

func JsonEncode

func JsonEncode(data interface{}) string

func JsonEncodeMapToByte

func JsonEncodeMapToByte(stringMap map[string]interface{}) []byte

func KeyworldListParse

func KeyworldListParse(keyworldListStr string) []string

func KeyworldListParseToMap

func KeyworldListParseToMap(keyworldText string) map[string]string

解析 k>>kc|k1>>kc1 到 map

func MD5Hash

func MD5Hash(text string) string

*

  • @note
  • 获取md5 hash串
  • @param string text 源串 *
  • @return string

func SetTelegramWebhook

func SetTelegramWebhook(botToken string, webhookURL string) (retText string, err error)

func StructToMap

func StructToMap(data interface{}) map[string]interface{}

func UnGzip

func UnGzip(byte []byte) []byte

func UrlMapToTGHTML

func UrlMapToTGHTML(urlMap map[string]string) (ret string, err error)

hanMap := make(map[string]string, 0) hanMap["汉//\\字"] = "http://han.com" hanMap["汉.df||字2"] = "http://han2.com" ret, err := util.UrlMapToTGHTML(hanMap)

if err != nil {
	fmt.Println("出错了", err)
} else {

	fmt.Println("ret", ret)
}

urlMap[title]url,转义,输出为TG支持的HTML格式文案

func UrlRegMatchReplace

func UrlRegMatchReplace(str string) (ret string)

func UrlRegMatchReplaceToMarkdown

func UrlRegMatchReplaceToMarkdown(str string) (ret string)

func UrlRegMatchReplaceToTGHTML

func UrlRegMatchReplaceToTGHTML(str string) (ret string, err error)

识别文案中链接,并转义,输出为TG支持的HTML格式文案

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳