Skip to content

Commit

Permalink
Update thread-mate schema, fix setting emoji indicator
Browse files Browse the repository at this point in the history
  • Loading branch information
mszostok committed Oct 26, 2023
1 parent f394c42 commit a8fcf2c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
5 changes: 5 additions & 0 deletions internal/executor/thread-mate/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
Expand Down
5 changes: 2 additions & 3 deletions internal/executor/thread-mate/jsonschema.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"assignees": {
"type": "array",
"items": {
"type": "string"
"type": "string",
"title": "Assignee"
},
"minItems": 1,
"title": "Assignees",
Expand All @@ -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"
Expand All @@ -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."
Expand Down
6 changes: 4 additions & 2 deletions pkg/bot/slack_socket.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
2 changes: 1 addition & 1 deletion pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit a8fcf2c

Please sign in to comment.