Add timestamps_format option to configuration file (#378)
This commit is contained in:
parent
3632f70e54
commit
057919e236
2 changed files with 5 additions and 2 deletions
|
|
@ -97,10 +97,10 @@ func (mt *MessagesText) createMessage(m discord.Message) {
|
|||
}
|
||||
|
||||
func (mt *MessagesText) createHeader(w io.Writer, m discord.Message, isReply bool) {
|
||||
time := m.Timestamp.Time().In(time.Local).Format(time.Kitchen)
|
||||
time := m.Timestamp.Time().In(time.Local).Format(cfg.TimestampsFormat)
|
||||
|
||||
if cfg.Timestamps && cfg.TimestampsBeforeAuthor {
|
||||
fmt.Fprintf(w, "[::d]%7s[::-] ", time)
|
||||
fmt.Fprintf(w, "[::d]%s[::-] ", time)
|
||||
}
|
||||
|
||||
if isReply {
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package config
|
|||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
"github.com/BurntSushi/toml"
|
||||
"github.com/ayn2op/discordo/internal/constants"
|
||||
|
|
@ -13,6 +14,7 @@ type Config struct {
|
|||
|
||||
Timestamps bool `toml:"timestamps"`
|
||||
TimestampsBeforeAuthor bool `toml:"timestamps_before_author"`
|
||||
TimestampsFormat string `toml:"timestamps_format"`
|
||||
|
||||
MessagesLimit uint8 `toml:"messages_limit"`
|
||||
|
||||
|
|
@ -28,6 +30,7 @@ func DefaultConfig() Config {
|
|||
|
||||
Timestamps: false,
|
||||
TimestampsBeforeAuthor: false,
|
||||
TimestampsFormat: time.Kitchen,
|
||||
|
||||
MessagesLimit: 50,
|
||||
Editor: "default",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue