mirror of
https://github.com/Mrs4s/go-cqhttp.git
synced 2025-05-06 20:13:50 +08:00
feature check_url_safely.
This commit is contained in:
parent
d4e8a3df4f
commit
4c570bdfe6
@ -1070,6 +1070,12 @@ func (bot *CQBot) CQGetEssenceMessageList(groupCode int64) MSG {
|
|||||||
return OK(list)
|
return OK(list)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (bot *CQBot) CQCheckUrlSafely(url string) MSG {
|
||||||
|
return OK(MSG{
|
||||||
|
"level": bot.Client.CheckUrlSafely(url),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
func (bot *CQBot) CQGetVersionInfo() MSG {
|
func (bot *CQBot) CQGetVersionInfo() MSG {
|
||||||
wd, _ := os.Getwd()
|
wd, _ := os.Getwd()
|
||||||
return OK(MSG{
|
return OK(MSG{
|
||||||
|
@ -506,6 +506,10 @@ func GetEssenceMsgList(s *httpServer, c *gin.Context) {
|
|||||||
c.JSON(200, s.bot.CQGetEssenceMessageList(gid))
|
c.JSON(200, s.bot.CQGetEssenceMessageList(gid))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func CheckUrlSafely(s *httpServer, c *gin.Context) {
|
||||||
|
c.JSON(200, s.bot.CQCheckUrlSafely(getParam(c, "url")))
|
||||||
|
}
|
||||||
|
|
||||||
func getParamOrDefault(c *gin.Context, k, def string) string {
|
func getParamOrDefault(c *gin.Context, k, def string) string {
|
||||||
r := getParam(c, k)
|
r := getParam(c, k)
|
||||||
if r != "" {
|
if r != "" {
|
||||||
@ -601,6 +605,7 @@ var httpApi = map[string]func(s *httpServer, c *gin.Context){
|
|||||||
"set_group_portrait": SetGroupPortrait,
|
"set_group_portrait": SetGroupPortrait,
|
||||||
"set_group_anonymous_ban": SetGroupAnonymousBan,
|
"set_group_anonymous_ban": SetGroupAnonymousBan,
|
||||||
"get_group_msg_history": GetGroupMessageHistory,
|
"get_group_msg_history": GetGroupMessageHistory,
|
||||||
|
"check_url_safely": CheckUrlSafely,
|
||||||
"download_file": DownloadFile,
|
"download_file": DownloadFile,
|
||||||
".handle_quick_operation": HandleQuickOperation,
|
".handle_quick_operation": HandleQuickOperation,
|
||||||
".ocr_image": OcrImage,
|
".ocr_image": OcrImage,
|
||||||
|
@ -601,6 +601,9 @@ var wsAPI = map[string]func(*coolq.CQBot, gjson.Result) coolq.MSG{
|
|||||||
"get_essence_msg_list": func(bot *coolq.CQBot, p gjson.Result) coolq.MSG {
|
"get_essence_msg_list": func(bot *coolq.CQBot, p gjson.Result) coolq.MSG {
|
||||||
return bot.CQGetEssenceMessageList(p.Get("group_id").Int())
|
return bot.CQGetEssenceMessageList(p.Get("group_id").Int())
|
||||||
},
|
},
|
||||||
|
"check_urk_safely": func(bot *coolq.CQBot, p gjson.Result) coolq.MSG {
|
||||||
|
return bot.CQCheckUrlSafely(p.Get("url").String())
|
||||||
|
},
|
||||||
"set_group_anonymous_ban": func(bot *coolq.CQBot, p gjson.Result) coolq.MSG {
|
"set_group_anonymous_ban": func(bot *coolq.CQBot, p gjson.Result) coolq.MSG {
|
||||||
obj := p.Get("anonymous")
|
obj := p.Get("anonymous")
|
||||||
flag := p.Get("anonymous_flag")
|
flag := p.Get("anonymous_flag")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user