mirror of
https://github.com/fumiama/NanoBot.git
synced 2026-06-09 12:40:24 +08:00
finish dms
This commit is contained in:
20
helper.go
20
helper.go
@@ -27,3 +27,23 @@ func getThisFuncName() string {
|
||||
func getCallerFuncName() string {
|
||||
return getFuncNameWithSkip(2)
|
||||
}
|
||||
|
||||
// MessageEscape 消息转义
|
||||
//
|
||||
// https://bot.q.qq.com/wiki/develop/api/openapi/message/message_format.html
|
||||
func MessageEscape(text string) string {
|
||||
text = strings.ReplaceAll(text, "&", "&")
|
||||
text = strings.ReplaceAll(text, "<", "<")
|
||||
text = strings.ReplaceAll(text, ">", ">")
|
||||
return text
|
||||
}
|
||||
|
||||
// MessageUnescape 消息解转义
|
||||
//
|
||||
// https://bot.q.qq.com/wiki/develop/api/openapi/message/message_format.html
|
||||
func MessageUnescape(text string) string {
|
||||
text = strings.ReplaceAll(text, "&", "&")
|
||||
text = strings.ReplaceAll(text, "<", "<")
|
||||
text = strings.ReplaceAll(text, ">", ">")
|
||||
return text
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user