Skip to content

Commit

Permalink
handler: clean up dra listing
Browse files Browse the repository at this point in the history
  • Loading branch information
nektro committed Oct 16, 2020
1 parent c8e663b commit 8edccd0
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions pkg/handler/listing.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package handler

import (
"errors"
"fmt"
"io/ioutil"
"mime"
"net/http"
Expand Down Expand Up @@ -194,17 +193,13 @@ func HandleFileListing(w http.ResponseWriter, r *http.Request) (string, string,

if user.Provider == "discord" && dc.Extra1 != "" && dc.Extra2 != "" {
dra := db.DiscordRoleAccess{}.All()
var p fastjson.Parser

rurl := F("%s/guilds/%s/members/%s", idata.DiscordAPI, dc.Extra1, user.Snowflake)
req, _ := http.NewRequest(http.MethodGet, rurl, strings.NewReader(""))
req.Header.Set("User-Agent", "nektro/andesite")
req.Header.Set("User-Agent", "nektro/andesite/"+etc.Version)
req.Header.Set("Authorization", "Bot "+dc.Extra2)
bys := util.DoHttpRequest(req)
v, err := p.Parse(string(bys))
if err != nil {
fmt.Println(2, "err", err.Error())
}
v, _ := fastjson.ParseBytes(bys)
if v != nil {
for _, item := range dra {
for _, i := range v.GetArray("roles") {
Expand Down

0 comments on commit 8edccd0

Please sign in to comment.