Skip to content

Commit

Permalink
Refactor SetUserCustomStatus function to handle empty text parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
walnuts1018 committed Jan 18, 2024
1 parent 6697dee commit 6228e1e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions infra/slack/slack.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ func (c *client) SetUserCustomStatus(emoji string, text string) error {
if !(strings.HasPrefix(emoji, ":") && strings.HasSuffix(emoji, ":")) {
emoji = ":" + emoji + ":"
}

err := c.slackClient.SetUserCustomStatus(fmt.Sprintf("now coding: %v", text), emoji, 0)
if text != "" {
text = fmt.Sprintf("now coding: %v", text)
}
err := c.slackClient.SetUserCustomStatus(text, emoji, 0)
if err != nil {
return fmt.Errorf("error setting status: %w", err)
}
Expand Down

0 comments on commit 6228e1e

Please sign in to comment.