feat(config): add configurable timestamp format with time_format field (#181)
This commit is contained in:
parent
ee08cd9593
commit
46aa968f7f
2 changed files with 4 additions and 1 deletions
|
|
@ -5,6 +5,7 @@ import (
|
|||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"time"
|
||||
|
||||
"github.com/BurntSushi/toml"
|
||||
)
|
||||
|
|
@ -41,6 +42,7 @@ type Config struct {
|
|||
Timestamps bool `toml:"timestamps"`
|
||||
MessagesLimit uint `toml:"messages_limit"`
|
||||
Timezone string `toml:"timezone"`
|
||||
TimeFormat string `toml:"time_format"`
|
||||
AttachmentDownloadsDir string `toml:"attachment_downloads_dir"`
|
||||
Identify IdentifyConfig `toml:"identify"`
|
||||
Theme ThemeConfig `toml:"theme"`
|
||||
|
|
@ -53,6 +55,7 @@ func New() *Config {
|
|||
Timestamps: false,
|
||||
MessagesLimit: 50,
|
||||
Timezone: "Local",
|
||||
TimeFormat: time.Stamp,
|
||||
AttachmentDownloadsDir: UserDownloadsDir(),
|
||||
Identify: IdentifyConfig{
|
||||
UserAgent: "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.67 Safari/537.36",
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ func buildMessage(app *App, m discord.Message) []byte {
|
|||
}
|
||||
|
||||
b.WriteString("[::d]")
|
||||
b.WriteString(m.Timestamp.Time().In(loc).Format(time.Stamp))
|
||||
b.WriteString(m.Timestamp.Time().In(loc).Format(app.Config.TimeFormat))
|
||||
b.WriteString("[::-]")
|
||||
b.WriteByte(' ')
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue