Merge pull request #597 from alexandear/remove-deprecated-func

Remove deprecated ioutil functions
bot-api-6.1
Syfaro 2022-10-19 20:25:33 -04:00 committed by GitHub
commit cc5463741b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 5 deletions

3
bot.go
View File

@ -7,7 +7,6 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"mime/multipart"
"net/http"
"net/url"
@ -151,7 +150,7 @@ func (bot *BotAPI) decodeAPIResponse(responseBody io.Reader, resp *APIResponse)
}
// if debug, read response body
data, err := ioutil.ReadAll(responseBody)
data, err := io.ReadAll(responseBody)
if err != nil {
return nil, err
}

View File

@ -1,7 +1,6 @@
package tgbotapi
import (
"io/ioutil"
"net/http"
"os"
"testing"
@ -139,7 +138,7 @@ func TestSendWithNewPhoto(t *testing.T) {
func TestSendWithNewPhotoWithFileBytes(t *testing.T) {
bot, _ := getBot(t)
data, _ := ioutil.ReadFile("tests/image.jpg")
data, _ := os.ReadFile("tests/image.jpg")
b := FileBytes{Name: "image.jpg", Bytes: data}
msg := NewPhoto(ChatID, b)
@ -195,7 +194,7 @@ func TestSendNewPhotoToChannel(t *testing.T) {
func TestSendNewPhotoToChannelFileBytes(t *testing.T) {
bot, _ := getBot(t)
data, _ := ioutil.ReadFile("tests/image.jpg")
data, _ := os.ReadFile("tests/image.jpg")
b := FileBytes{Name: "image.jpg", Bytes: data}
msg := NewPhotoToChannel(Channel, b)