diff options
author | Ben Morrison <ben@gbmor.dev> | 2019-05-30 03:11:48 -0400 |
---|---|---|
committer | Ben Morrison <ben@gbmor.dev> | 2019-05-30 03:11:48 -0400 |
commit | 24fcf3a13a85365e13fb086acf17f6b251798af0 (patch) | |
tree | a05277dde5e12c2f6884f56ccd367de4c397f65e | |
parent | d983da3eccfde568bdfe9ab2ddee4ba8dd6fb7f5 (diff) | |
download | goofbot-24fcf3a13a85365e13fb086acf17f6b251798af0.tar.gz |
eliminating dupes and removing : from usernames
-rw-r--r-- | main.go | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/main.go b/main.go index 52df14b..7f6e654 100644 --- a/main.go +++ b/main.go @@ -153,11 +153,17 @@ func main() { split := strings.Split(bytestream.String(), " ") var out bytes.Buffer + nicks := make(map[string]bool) for _, e := range split { - if !strings.Contains(e, ":") { - out.Write([]byte(e + " ")) + if strings.HasSuffix(e, ":") { + clip := string(e[:len(e)-1]) + nicks[clip] = true + } else { + nicks[e] = true } - + } + for k := range nicks { + out.WriteString(k + " ") } c.Cmd.Reply(e, "Check your private messages!") |