Support go 1.13

This commit is contained in:
blank X 2022-01-04 21:49:16 +07:00
parent c7805b4bbd
commit a034e52a6e
Signed by: blankie
GPG Key ID: CC15FC822C7F61F5
3 changed files with 5 additions and 4 deletions

2
go.mod
View File

@ -1,3 +1,3 @@
module ridi module ridi
go 1.17 go 1.13

View File

@ -7,6 +7,7 @@ import (
"fmt" "fmt"
"html" "html"
"io" "io"
"io/ioutil"
"mime/multipart" "mime/multipart"
"net/http" "net/http"
"net/url" "net/url"
@ -29,7 +30,7 @@ func handleMessage(client *http.Client, botToken string, message *Message) error
if len(split) == 2 { if len(split) == 2 {
command.Stdin = strings.NewReader(split[1]) command.Stdin = strings.NewReader(split[1])
} }
stdout, err := os.CreateTemp("", "ridi*") stdout, err := ioutil.TempFile("", "ridi*")
if err != nil { if err != nil {
return fmt.Errorf("failed to create temporary file: %s", err) return fmt.Errorf("failed to create temporary file: %s", err)
} }

View File

@ -3,13 +3,13 @@ package main
import ( import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"io" "io/ioutil"
"net/http" "net/http"
) )
func parseBody(resp *http.Response) (json.RawMessage, error) { func parseBody(resp *http.Response) (json.RawMessage, error) {
defer resp.Body.Close() defer resp.Body.Close()
bytes, err := io.ReadAll(resp.Body) bytes, err := ioutil.ReadAll(resp.Body)
if err != nil { if err != nil {
return nil, fmt.Errorf("failed to read response body: %s", err) return nil, fmt.Errorf("failed to read response body: %s", err)
} }