MCPcopy Create free account
hub / github.com/FloatTech/ZeroBot-Plugin-Playground / getRole

Function getRole

plugin/klala/net.go:28–52  ·  view source on GitHub ↗
(uid string)

Source from the content-addressed store, hash-verified

26 cryptic = helper.BytesToString(t)
27}
28func getRole(uid string) (body []byte, err error) {
29 var client = &http.Client{}
30 req, err := http.NewRequest(http.MethodGet, nets+path+uid, nil)
31
32 if err != nil {
33 return nil, err
34 }
35 req.Header.Add("User-Agent", cryptic)
36 req.Header.Add("Accept", "*/*")
37
38 res, err := client.Do(req)
39 if err != nil {
40 return nil, err
41 }
42 defer res.Body.Close()
43
44 if res.StatusCode < http.StatusOK || res.StatusCode >= http.StatusBadRequest {
45 return nil, errors.New("获取数据失败, Code: " + strconv.Itoa(res.StatusCode))
46 }
47 body, err = io.ReadAll(res.Body)
48 if err != nil {
49 return nil, err
50 }
51 return
52}
53
54type info struct {
55 PlayerDetailInfo struct {

Callers 1

saveRoelFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected