feat: message timestamps

* made it easier to styles and prefix messages
* added timestamps to messages
* added prefix and styles to server messages
* append current date to host channel
* fixed some styles issues
This commit is contained in:
2022-02-19 16:24:39 +02:00
parent 6c538cc352
commit f4dd0066c8
11 changed files with 222 additions and 51 deletions
+12 -2
View File
@@ -17,6 +17,9 @@
package cmds
import (
"fmt"
"time"
tea "github.com/charmbracelet/bubbletea"
"github.com/illusionman1212/gorc/irc"
)
@@ -38,12 +41,19 @@ func Quit(client *irc.Client) tea.Cmd {
}
type SendPrivMsgMsg struct {
Msg string
Msg string
Timestamp string
}
func SendPrivMsg(msg string) tea.Cmd {
return func() tea.Msg {
return SendPrivMsgMsg{Msg: msg}
now := time.Now()
timestamp := fmt.Sprintf("[%02d:%02d]", now.Hour(), now.Minute())
return SendPrivMsgMsg{
Msg: msg,
Timestamp: timestamp,
}
}
}