feat(config): move Timestamps & TimestampsFormat to its own table
This commit is contained in:
parent
ecabfba13c
commit
284853dc4a
2 changed files with 12 additions and 7 deletions
|
|
@ -128,8 +128,8 @@ func (mt *MessagesText) createMessage(m discord.Message) {
|
|||
}
|
||||
|
||||
func (mt *MessagesText) createHeader(w io.Writer, m discord.Message, isReply bool) {
|
||||
if mt.cfg.Timestamps {
|
||||
time := m.Timestamp.Time().In(time.Local).Format(mt.cfg.TimestampsFormat)
|
||||
if mt.cfg.Timestamps.Enabled {
|
||||
time := m.Timestamp.Time().In(time.Local).Format(mt.cfg.Timestamps.Format)
|
||||
fmt.Fprintf(w, "[::d]%s[::-] ", time)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,6 +14,11 @@ import (
|
|||
const fileName = "config.toml"
|
||||
|
||||
type (
|
||||
Timestamps struct {
|
||||
Enabled bool `toml:"enabled"`
|
||||
Format string `toml:"format"`
|
||||
}
|
||||
|
||||
Identify struct {
|
||||
Status discord.Status `toml:"status"`
|
||||
Browser string `toml:"browser"`
|
||||
|
|
@ -40,9 +45,7 @@ type (
|
|||
ShowAttachmentLinks bool `toml:"show_attachment_links"`
|
||||
MessagesLimit uint8 `toml:"messages_limit"`
|
||||
|
||||
Timestamps bool `toml:"timestamps"`
|
||||
TimestampsFormat string `toml:"timestamps_format"`
|
||||
|
||||
Timestamps Timestamps `toml:"timestamps"`
|
||||
Identify Identify `toml:"identify"`
|
||||
Notifications Notifications `toml:"notifications"`
|
||||
|
||||
|
|
@ -60,8 +63,10 @@ func defaultConfig() *Config {
|
|||
ShowAttachmentLinks: true,
|
||||
MessagesLimit: 50,
|
||||
|
||||
Timestamps: false,
|
||||
TimestampsFormat: time.Kitchen,
|
||||
Timestamps: Timestamps{
|
||||
Enabled: false,
|
||||
Format: time.Kitchen,
|
||||
},
|
||||
|
||||
Identify: Identify{
|
||||
Status: discord.OnlineStatus,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue