From 0d0e0039e55fb9f06ad3fd2928aa8743946610b3 Mon Sep 17 00:00:00 2001 From: c9s Date: Mon, 14 Mar 2022 21:20:53 +0800 Subject: [PATCH] add DEBUG_SLACK env var --- pkg/interact/slack.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/pkg/interact/slack.go b/pkg/interact/slack.go index 6e7863417..1a4ad3310 100644 --- a/pkg/interact/slack.go +++ b/pkg/interact/slack.go @@ -13,6 +13,8 @@ import ( "github.com/slack-go/slack" "github.com/slack-go/slack/slackevents" "github.com/slack-go/slack/socketmode" + + "github.com/c9s/bbgo/pkg/util" ) type SlackReply struct { @@ -165,14 +167,17 @@ type Slack struct { } func NewSlack(client *slack.Client) *Slack { - socket := socketmode.New( - client, - socketmode.OptionDebug(true), + var opts = []socketmode.Option{ socketmode.OptionLog( stdlog.New(os.Stdout, "socketmode: ", stdlog.Lshortfile|stdlog.LstdFlags)), - ) + } + if b, ok := util.GetEnvVarBool("DEBUG_SLACK"); ok { + opts = append(opts, socketmode.OptionDebug(b)) + } + + socket := socketmode.New(client, opts...) return &Slack{ client: client, socket: socket,