diff -r 98d8850e0551 helper.go --- a/helper.go Thu Dec 13 15:05:57 2018 -0600 +++ b/helper.go Thu Dec 13 20:36:53 2018 -0700 @@ -5,6 +5,7 @@ "fmt" "github.com/bwmarrin/discordgo" "io" + "io/ioutil" "log" "os" "os/exec" @@ -60,11 +61,16 @@ //PrintMessages prints amount of Messages to CLI func PrintMessages(Amount int) { for Key, m := range State.Messages { + name := m.Author.Username + if member, ok := State.Members[m.Author.Username]; ok { + if member.Nick != "" { + name = member.Nick + } + } if Key >= len(State.Messages)-Amount { Messages := ReceivingMessageParser(m) for _, Msg := range Messages { - //log.Printf("> %s > %s\n", UserName(m.Author.Username), Msg) - MessagePrint(string(m.Timestamp), m.Author.Username, Msg) + MessagePrint(string(m.Timestamp), name, Msg) } } @@ -94,7 +100,7 @@ switch runtime.GOOS { case "plan9": pr, pw := io.Pipe() - cmd := exec.Command("/bin/aux/statusmsg", "-k", *notifyFlag, Title) + cmd := exec.Command("/bin/aux/statusmsg", *notifyFlag, Title) cmd.Stdin = pr go func() { defer pw.Close() @@ -105,7 +111,7 @@ if err != nil { Msg(ErrorMsg, "%s\n", err) } - + ioutil.WriteFile("/dev/wctl", []byte("current"), 0644) default: cmd := exec.Command("notify-send", Title, m.ContentWithMentionsReplaced()) err := cmd.Start() diff -r 98d8850e0551 main.go --- a/main.go Thu Dec 13 15:05:57 2018 -0600 +++ b/main.go Thu Dec 13 20:36:53 2018 -0700 @@ -141,9 +141,8 @@ //ReplaceMentions replaces mentions to ID func ReplaceMentions(input string) string { // Check for guild members that match - channel := State.Guild.Members - for _, member := range channel { - if member.Nick == input[1:] { + for _, member := range State.Guild.Members { + if strings.HasPrefix(member.Nick, input[1:]) { return member.User.Mention() } if strings.HasPrefix(member.User.Username, input[1:]) { @@ -158,7 +157,6 @@ for _, channel := range userChannels { for _, recipient := range channel.Recipients { if strings.HasPrefix(input[1:], recipient.Username) { - fmt.Println("usermatch") return recipient.Mention() } }