A modular Twitch bot made in Go
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
380 B

2 years ago
  1. package twitchbot
  2. import "strings"
  3. func (c *Command) Build() string {
  4. builder := strings.Builder{}
  5. if c.Prefix != "" {
  6. builder.WriteString(":" + c.Prefix + " ")
  7. }
  8. builder.WriteString(c.Command)
  9. for _, arg := range c.Args {
  10. if arg != "" {
  11. builder.WriteString(" " + arg)
  12. }
  13. }
  14. if c.Suffix != "" {
  15. builder.WriteString(" :" + c.Suffix)
  16. }
  17. return builder.String()
  18. }