mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-25 16:25:16 +00:00
add DEBUG_SLACK env var
This commit is contained in:
parent
19f01bbca6
commit
0d0e0039e5
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue
Block a user