Skip to content

Commit

Permalink
Merge pull request #45 from rneatherway/rneatherway/rm-newlines
Browse files Browse the repository at this point in the history
Remove extra newlines in wait output
  • Loading branch information
rneatherway authored May 23, 2023
2 parents 122546d + 7e1c5ab commit b45d478
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions internal/slackclient/rtm_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,19 @@ func (c *RTMClient) correctUser(message *RTMEvent, botName string) bool {
}

func trimAndPrint(text string) {
s, err := markdown.Render(strings.TrimRight(text, " \t\n"))
s, err := markdown.Render(text)
if err != nil {
// This is a bit lazy, but the default configuration of the markdown
// renderer cannot fail.
panic(err)
}

fmt.Println(s)
s = strings.TrimRight(s, " \t\n")
if s == "" {
return
}

fmt.Printf("%s\n", s)
}

// ListenForMessagesFromBot listens for the first message from the bot in a given channel and prints its contents
Expand Down

0 comments on commit b45d478

Please sign in to comment.