Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sadath #1262

Closed
wants to merge 6 commits into from
Closed

Sadath #1262

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ For faster development, you can also build and run Botkube outside K8s cluster.
# Fetch the dependencies
go mod download
# Build the binary
go build ./cmd/botkube-agent/
go build -o botkube ./cmd/botkube-agent/
```

2. Create a local configuration file to override default values. For example, set communication credentials, specify cluster name, and disable analytics:
Expand Down
38 changes: 30 additions & 8 deletions pkg/bot/slack_cloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -519,14 +519,36 @@ func (b *CloudSlack) send(ctx context.Context, event slackMessage, resp interact
var file *slack.File
var err error
if len(markdown) >= slackMaxMessageSize {
file, err = uploadFileToSlack(ctx, event.Channel, resp, b.client, event.ThreadTimeStamp)
if err != nil {
return err
}
resp = interactive.CoreMessage{
Message: api.Message{
PlaintextInputs: resp.PlaintextInputs,
},
if strings.Contains(resp.Description, "logs") {

file, err = uploadFileToSlack(ctx, event.Channel, resp, b.client, event.ThreadTimeStamp)
if err != nil {
return err
}
resp = interactive.CoreMessage{
Message: api.Message{
PlaintextInputs: resp.PlaintextInputs,
},
}
} else {
newBlocks := strings.Split(resp.BaseBody.CodeBlock, "\n")

newBlocks = newBlocks[:45]

result := strings.Join(newBlocks, "\n")

fmt.Println("result is",result)

resp = interactive.CoreMessage{
Description: resp.Description,
Message: api.Message{
PlaintextInputs: resp.PlaintextInputs,

BaseBody: api.Body{
CodeBlock: result,
},
},
}
}
}

Expand Down
38 changes: 30 additions & 8 deletions pkg/bot/slack_socket.go
Original file line number Diff line number Diff line change
Expand Up @@ -407,14 +407,36 @@ func (b *SocketSlack) send(ctx context.Context, event slackMessage, resp interac
var file *slack.File
var err error
if len(markdown) >= slackMaxMessageSize {
file, err = uploadFileToSlack(ctx, event.Channel, resp, b.client, event.ThreadTimeStamp)
if err != nil {
return err
}
resp = interactive.CoreMessage{
Message: api.Message{
PlaintextInputs: resp.PlaintextInputs,
},
if strings.Contains(resp.Description, "logs") {

file, err = uploadFileToSlack(ctx, event.Channel, resp, b.client, event.ThreadTimeStamp)
if err != nil {
return err
}
resp = interactive.CoreMessage{
Message: api.Message{
PlaintextInputs: resp.PlaintextInputs,
},
}
} else {
newBlocks := strings.Split(resp.BaseBody.CodeBlock, "\n")

newBlocks = newBlocks[:45]

result := strings.Join(newBlocks, "\n")

fmt.Println("result is",result)

resp = interactive.CoreMessage{
Description: resp.Description,
Message: api.Message{
PlaintextInputs: resp.PlaintextInputs,

BaseBody: api.Body{
CodeBlock: result,
},
},
}
}
}

Expand Down
Loading