From 60e5c03229f76dd3ee53df9821e140300a74033f Mon Sep 17 00:00:00 2001 From: ShotaKitazawa Date: Sat, 9 Nov 2024 15:51:38 +0900 Subject: [PATCH] update slack client --- go.mod | 2 +- go.sum | 4 ++-- pkg/slack/slack.go | 12 ++++++------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/go.mod b/go.mod index 549b133..eaa4013 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/cheggaaa/pb v1.0.29 github.com/golang/mock v1.6.0 github.com/pkg/sftp v1.13.4 - github.com/slack-go/slack v0.10.3 + github.com/slack-go/slack v0.15.0 github.com/spf13/cobra v1.4.0 github.com/spf13/pflag v1.0.5 go.uber.org/zap v1.21.0 diff --git a/go.sum b/go.sum index 1579c1c..65ea085 100644 --- a/go.sum +++ b/go.sum @@ -41,8 +41,8 @@ github.com/pkg/sftp v1.13.4/go.mod h1:LzqnAvaD5TWeNBsZpfKxSYn1MbjWwOsCIAFFJbpIsK github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/slack-go/slack v0.10.3 h1:kKYwlKY73AfSrtAk9UHWCXXfitudkDztNI9GYBviLxw= -github.com/slack-go/slack v0.10.3/go.mod h1:hlGi5oXA+Gt+yWTPP0plCdRKmjsDxecdHxYQdlMQKOw= +github.com/slack-go/slack v0.15.0 h1:LE2lj2y9vqqiOf+qIIy0GvEoxgF1N5yLGZffmEZykt0= +github.com/slack-go/slack v0.15.0/go.mod h1:hlGi5oXA+Gt+yWTPP0plCdRKmjsDxecdHxYQdlMQKOw= github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= github.com/spf13/cobra v1.4.0 h1:y+wJpx64xcgO1V+RcnwW0LEHxTKRi2ZDPSBjWnrg88Q= github.com/spf13/cobra v1.4.0/go.mod h1:Wo4iy3BUC+X2Fybo0PDqwJIv3dNRiZLHQymsfxlB84g= diff --git a/pkg/slack/slack.go b/pkg/slack/slack.go index 99721d0..a1ba0fc 100644 --- a/pkg/slack/slack.go +++ b/pkg/slack/slack.go @@ -43,17 +43,17 @@ func (c Client) SendFileContent(ctx context.Context, channel, filename, content, if channel == "" { channel = c.defaultChannelId } - params := slack.FileUploadParameters{ + params := slack.UploadFileV2Parameters{ Title: title, - Filetype: "txt", - File: filename, + Filename: filename, Content: content, - Channels: []string{channel}, + FileSize: len(content), + Channel: channel, } - file, err := c.client.UploadFile(params) + file, err := c.client.UploadFileV2(params) if err != nil { return err } - c.log.Debug(fmt.Sprintf("sent file %s to Slack", file.Name)) + c.log.Debug(fmt.Sprintf("sent file %s to Slack", file.Title)) return nil }