From a8fcf2cb3ac96e3268d5404b7c61de270a94f38d Mon Sep 17 00:00:00 2001 From: Mateusz Szostok Date: Thu, 26 Oct 2023 16:13:46 +0200 Subject: [PATCH] Update thread-mate schema, fix setting emoji indicator --- internal/executor/thread-mate/config.go | 5 +++++ internal/executor/thread-mate/jsonschema.json | 5 ++--- pkg/bot/slack_socket.go | 6 ++++-- pkg/config/config.go | 2 +- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/internal/executor/thread-mate/config.go b/internal/executor/thread-mate/config.go index 86095e91d..8f0b78637 100644 --- a/internal/executor/thread-mate/config.go +++ b/internal/executor/thread-mate/config.go @@ -56,6 +56,11 @@ func (c *Config) Validate() error { // MergeConfigs merges the configuration. func MergeConfigs(configs []*executor.Config) (Config, error) { defaults := Config{ + Logger: config.Logger{ + Level: "info", + DisableColors: false, + Formatter: "text", + }, RoundRobin: RoundRobinConfig{ GroupName: "default", }, diff --git a/internal/executor/thread-mate/jsonschema.json b/internal/executor/thread-mate/jsonschema.json index 700f544b4..dc48ac3ad 100644 --- a/internal/executor/thread-mate/jsonschema.json +++ b/internal/executor/thread-mate/jsonschema.json @@ -24,7 +24,8 @@ "assignees": { "type": "array", "items": { - "type": "string" + "type": "string", + "title": "Assignee" }, "minItems": 1, "title": "Assignees", @@ -46,7 +47,6 @@ "properties": { "userCooldownTime": { "type": "string", - "format": "duration", "default": "3m", "description": "Represents the time that must elapse for a given user's message before the 'pick' method can be used again.", "title": "User Cooldown Time" @@ -63,7 +63,6 @@ "properties": { "syncInterval": { "type": "string", - "format": "duration", "default": "5s", "title": "Sync Interval", "description": "Represents the time that must elapse before saving in-memory data." diff --git a/pkg/bot/slack_socket.go b/pkg/bot/slack_socket.go index 3b7202d6f..affa2f825 100644 --- a/pkg/bot/slack_socket.go +++ b/pkg/bot/slack_socket.go @@ -409,12 +409,14 @@ func (b *SocketSlack) handleMessage(ctx context.Context, event slackMessage) err if !hasBotMention { // there wasn't botkube mentions, trying to match against messages messageTrigger, matched := b.hasMatchingTextMessageTrigger(channel, request, event.UserID) if !matched { - b.log.Debugf("Ignoring message as it doesn't contain %q mention nor text matchers", b.botID) + b.log.WithField("matchers", formatx.StructDumper().Sdump(channel.MessageTriggers)).Debugf("Ignoring message as it doesn't contain %q mention nor text matchers", b.botID) return nil } bindings = config.BotBindings{Executors: messageTrigger.Executors} request = messageTrigger.Command - processedEmoji = messageTrigger.ProcessedEmojiIndicator + if messageTrigger.ProcessedEmojiIndicator != nil { + processedEmoji = *messageTrigger.ProcessedEmojiIndicator + } } permalink, err := b.client.GetPermalink(&slack.PermalinkParameters{ diff --git a/pkg/config/config.go b/pkg/config/config.go index 710ea2017..348661f57 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -204,7 +204,7 @@ type TextMessageTriggers struct { Users UsersMessageConstraints `yaml:"users"` Command string `yaml:"command"` Executors []string `yaml:"executors"` - ProcessedEmojiIndicator string `yaml:"processedEmojiIndicator"` + ProcessedEmojiIndicator *string `yaml:"processedEmojiIndicator,omitempty"` } type UsersMessageConstraints struct {