func createMessage(m string) Message { return Message{ ID: util.RandomID(), Addr: self, Body: m, Nick: *selfNick, Timestamp: time.Now().Unix(), } }
func createMessage(m string) Message { for shortcut, emoji := range emojis { m = strings.Replace(m, shortcut, emoji, -1) } return Message{ ID: util.RandomID(), Addr: self, Body: m, Nick: *selfNick, Timestamp: time.Now().Unix(), } }
func readInput() { s := bufio.NewScanner(os.Stdin) for s.Scan() { body := s.Text() if body != "" { m := Message{ ID: util.RandomID(), Addr: self, Body: s.Text(), Nick: *selfNick, } Seen(m.ID) broadcast(m) } } if err := s.Err(); err != nil { log.Fatal(err) } }