Color-coded attachements & link toggling (#438)
Co-authored-by: Ayyan <119342035+ayn2op@users.noreply.github.com>
This commit is contained in:
parent
54c55eb69b
commit
a6e6388322
3 changed files with 19 additions and 9 deletions
|
|
@ -160,7 +160,11 @@ func (mt *MessagesText) createBody(w io.Writer, m discord.Message, isReply bool)
|
|||
func (mt *MessagesText) createFooter(w io.Writer, m discord.Message) {
|
||||
for _, a := range m.Attachments {
|
||||
fmt.Fprintln(w)
|
||||
fmt.Fprintf(w, "[%s]: %s", a.Filename, a.URL)
|
||||
if cfg.ShowAttachmentLinks {
|
||||
fmt.Fprintf(w, "[%s][%s]:\n%s[-]", cfg.Theme.MessagesText.AttachmentColor, a.Filename, a.URL)
|
||||
} else {
|
||||
fmt.Fprintf(w, "[%s][%s][-]", cfg.Theme.MessagesText.AttachmentColor, a.Filename)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@ type Config struct {
|
|||
TimestampsBeforeAuthor bool `toml:"timestamps_before_author"`
|
||||
TimestampsFormat string `toml:"timestamps_format"`
|
||||
|
||||
ShowAttachmentLinks bool `toml:"show_attachment_links"`
|
||||
|
||||
Keys Keys `toml:"keys"`
|
||||
Theme Theme `toml:"theme"`
|
||||
}
|
||||
|
|
@ -34,6 +36,8 @@ func defaultConfig() *Config {
|
|||
Timestamps: false,
|
||||
TimestampsBeforeAuthor: false,
|
||||
TimestampsFormat: time.Kitchen,
|
||||
|
||||
ShowAttachmentLinks: true,
|
||||
|
||||
Keys: defaultKeys(),
|
||||
Theme: defaultTheme(),
|
||||
|
|
|
|||
|
|
@ -26,10 +26,11 @@ type (
|
|||
MessagesTextTheme struct {
|
||||
ReplyIndicator string `toml:"reply_indicator"`
|
||||
|
||||
AuthorColor string `toml:"author_color"`
|
||||
ContentColor string `toml:"content_color"`
|
||||
EmojiColor string `toml:"emoji_color"`
|
||||
LinkColor string `toml:"link_color"`
|
||||
AuthorColor string `toml:"author_color"`
|
||||
ContentColor string `toml:"content_color"`
|
||||
EmojiColor string `toml:"emoji_color"`
|
||||
LinkColor string `toml:"link_color"`
|
||||
AttachmentColor string `toml:"attachment_color"`
|
||||
}
|
||||
)
|
||||
|
||||
|
|
@ -52,10 +53,11 @@ func defaultTheme() Theme {
|
|||
MessagesText: MessagesTextTheme{
|
||||
ReplyIndicator: string(tview.BoxDrawingsLightArcDownAndRight) + " ",
|
||||
|
||||
AuthorColor: "aqua",
|
||||
ContentColor: tview.Styles.PrimaryTextColor.String(),
|
||||
EmojiColor: "green",
|
||||
LinkColor: "blue",
|
||||
AuthorColor: "aqua",
|
||||
ContentColor: tview.Styles.PrimaryTextColor.String(),
|
||||
EmojiColor: "green",
|
||||
LinkColor: "blue",
|
||||
AttachmentColor: "yellow",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue