瀏覽代碼

Add timestamps field to configuration

ayn2op 3 年之前
父節點
當前提交
eac2a2cd76
共有 2 個文件被更改,包括 9 次插入2 次删除
  1. 1 0
      config.go
  2. 8 2
      messages_text.go

+ 1 - 0
config.go

@@ -36,6 +36,7 @@ type ThemeConfig struct {
 type Config struct {
 	Mouse         bool `yaml:"mouse"`
 	MessagesLimit uint `yaml:"messages_limit"`
+	Timestamps    bool `yaml:"timestamps"`
 
 	Theme ThemeConfig `yaml:"theme"`
 }

+ 8 - 2
messages_text.go

@@ -20,6 +20,7 @@ func newMessagesText() *MessagesText {
 	mt.SetDynamicColors(true)
 	mt.SetRegions(true)
 	mt.SetWordWrap(true)
+	mt.ScrollToEnd()
 
 	mt.SetBorder(cfg.Theme.MessagesText.Border)
 
@@ -41,6 +42,7 @@ func (mt *MessagesText) newMessage(m *discord.Message) error {
 
 			// Author
 			mt.newAuthor(m.ReferencedMessage)
+
 			// Content
 			mt.newContent(m.ReferencedMessage)
 
@@ -48,10 +50,14 @@ func (mt *MessagesText) newMessage(m *discord.Message) error {
 			fmt.Fprintln(mt)
 		}
 
-		// Timestamps
-		mt.newTimestamp(m)
+		if cfg.Timestamps {
+			// Timestamps
+			mt.newTimestamp(m)
+		}
+
 		// Author
 		mt.newAuthor(m)
+
 		// Content
 		mt.newContent(m)