修改部分逻辑

This commit is contained in:
liyp 2024-04-01 11:19:52 +08:00
parent 822847adcb
commit 3846c6b4a4

View file

@ -5,7 +5,6 @@ import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"go-bot/config" "go-bot/config"
"io"
"net/http" "net/http"
) )
@ -67,17 +66,21 @@ func contains(slice []string, value string) bool {
} }
func (s *StdAns) GetMsg() string { func (s *StdAns) GetMsg() string {
if s.Parms[0] != "" { // 暂时设置权限校验不通过什么都不提示
return "咱也不知道 " + s.Parms[0] + "是啥呢!" return "-1"
} else { // if s.Parms[0] != "" {
// return "咱也不知道 " + s.Parms[0] + "是啥呢!"
// } else {
return "汝再调戏咱,咱可就生气了!!" // return "汝再调戏咱,咱可就生气了!!"
} // }
} }
func (s *StdAns) SendMsg(msg string) bool { func (s *StdAns) SendMsg(msg string) bool {
if msg == "-1" {
return false
}
requestBody, err := json.Marshal(map[string]interface{}{ requestBody, err := json.Marshal(map[string]interface{}{
"action": "send_msg", "action": "send_msg",
"params": map[string]interface{}{ "params": map[string]interface{}{
@ -105,7 +108,7 @@ func (s *StdAns) SendMsg(msg string) bool {
return false return false
} }
defer resp.Body.Close() defer resp.Body.Close()
res, _ := io.ReadAll(resp.Body) // res, _ := io.ReadAll(resp.Body)
fmt.Println("响应返回:", string(res)) // fmt.Println("响应返回:", string(res))
return true return true
} }