Make times configurable
MODIFY
internal/config/config.go
internal/config/config.go
@@ -14,6 +14,10 @@ const (
//AppNameLowercase is the representative name, but lowercase.
//It us used for filepaths and such.
AppNameLowercase = "cordless"
+
+ HourMinuteAndSeconds = 0
+ HourAndMinute = 1
+ NoTime = 2
)
var (
@@ -24,6 +28,7 @@ var (
type Config struct {
Token string
+ Times int
ShowUserContainer bool
UseFrame bool
}

MODIFY
internal/ui/window.go
internal/ui/window.go
@@ -367,9 +367,16 @@ func (window *Window) AddMessages(messages []*discordgo.Message) {
time, parseError := message.Timestamp.Parse()
if parseError == nil {
time := time.Local()
- timeCellText := fmt.Sprintf("%02d:%02d:%02d", time.Hour(), time.Minute(), time.Second())
+ var timeCellText string
+ conf := config.GetConfig()
+ if conf.Times == config.HourMinuteAndSeconds {
+ timeCellText = fmt.Sprintf("%02d:%02d:%02d", time.Hour(), time.Minute(), time.Second())
+ window.messageContainer.SetCell(rowIndex, 0, tview.NewTableCell(timeCellText))
+ } else if conf.Times == config.HourAndMinute {
+ timeCellText = fmt.Sprintf("%02d:%02d", time.Hour(), time.Minute())
window.messageContainer.SetCell(rowIndex, 0, tview.NewTableCell(timeCellText))
}
+ }
//TODO use nickname instead.
window.messageContainer.SetCell(rowIndex, 1, tview.NewTableCell(message.Author.Username))

Make times configurable