Skip to content

Commit

Permalink
Ensure that we trim spaces, before removing mention via regex
Browse files Browse the repository at this point in the history
  • Loading branch information
mszostok committed Nov 15, 2023
1 parent 1b81f07 commit 9848cb2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions pkg/bot/teams_cloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"encoding/json"
"fmt"
"regexp"
"strings"
"sync"
"time"

Expand Down Expand Up @@ -399,6 +400,7 @@ func (b *CloudTeams) setChannels(channels map[string]teamsCloudChannelConfigByID
}

func (b *CloudTeams) trimBotMention(msg string) string {
msg = strings.TrimSpace(msg)
return b.botMentionRegex.ReplaceAllString(msg, "")
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/execute/plugin_executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func (e *PluginExecutor) Execute(ctx context.Context, bindings []string, slackSt
Command: cmdCtx.CleanCmd,
Configs: configs,
Context: executor.ExecuteInputContext{
IsInteractivitySupported: e.doesPlatformInteractivity(cmdCtx),
IsInteractivitySupported: e.isInteractivitySupported(cmdCtx),
SlackState: slackState,
KubeConfig: kubeconfig,
Message: executor.Message{
Expand Down Expand Up @@ -146,7 +146,7 @@ func (e *PluginExecutor) Execute(ctx context.Context, bindings []string, slackSt
return out, nil
}

func (e *PluginExecutor) doesPlatformInteractivity(cmdCtx CommandContext) bool {
func (e *PluginExecutor) isInteractivitySupported(cmdCtx CommandContext) bool {
// TODO(https://github.com/kubeshop/botkube-cloud/issues/645): add support for kubectl builder
if strings.EqualFold(cmdCtx.CleanCmd, "kubectl") && cmdCtx.Platform == config.CloudTeamsCommPlatformIntegration {
// event though the cloud Teams support some interactivity, we do not support the command builder yet.
Expand Down

0 comments on commit 9848cb2

Please sign in to comment.