fix lint
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,4 +1,5 @@
|
|||||||
.env
|
.env
|
||||||
node_modules
|
node_modules
|
||||||
__debug_bin.exe
|
__debug_bin.exe
|
||||||
|
__debug_bin
|
||||||
.vscode
|
.vscode
|
||||||
@@ -3,7 +3,7 @@ package handlers
|
|||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@ func CallDurpAPI(url string, accesstoken string) []byte {
|
|||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
|
|
||||||
body, err := ioutil.ReadAll(resp.Body)
|
body, err := io.ReadAll(resp.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("Error reading response:", err)
|
fmt.Println("Error reading response:", err)
|
||||||
return nil
|
return nil
|
||||||
@@ -58,7 +58,7 @@ func GenerateToken(clientID string, grantType string, url string, username strin
|
|||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
|
|
||||||
body, err := ioutil.ReadAll(resp.Body)
|
body, err := io.ReadAll(resp.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("Error reading response:", err)
|
fmt.Println("Error reading response:", err)
|
||||||
return model.AccessTokenResponse{}
|
return model.AccessTokenResponse{}
|
||||||
|
|||||||
@@ -33,7 +33,10 @@ func GetUnraidUsage(s *discordgo.Session, m *discordgo.MessageCreate) {
|
|||||||
|
|
||||||
jsonData, _ := json.MarshalIndent(response, "", " ")
|
jsonData, _ := json.MarshalIndent(response, "", " ")
|
||||||
jsonStr := string(jsonData)
|
jsonStr := string(jsonData)
|
||||||
s.ChannelMessageSend(m.ChannelID, "Power Usage Response:\n```json\n"+jsonStr+"\n```")
|
_, err = s.ChannelMessageSend(m.ChannelID, "Power Usage Response:\n```json\n"+jsonStr+"\n```")
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println("Failed to send message")
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user