diff --git a/util/discord.go b/util/discord.go index 2a4c0f8..e894de8 100644 --- a/util/discord.go +++ b/util/discord.go @@ -21,20 +21,28 @@ func WriteMessage(v *tview.TextView, s *state.State, m discord.Message) { if m.EditedTimestamp.IsValid() { b.WriteString(" [::d](edited)[-:-:-]") } - // TODO(rigormorrtiss): display the message embed using "special" format - if len(m.Embeds) > 0 { - b.WriteString("\n") - } + // $ *linebreak*EMBED + writeEmbeds(&b, m.Embeds) // $ *linebreak*ATTACHMENT_URL writeAttachments(&b, m.Attachments) fmt.Fprintln(v, b.String()) } +func writeEmbeds(b *strings.Builder, embeds []discord.Embed) { + for range embeds { + b.WriteString("\n") + } +} + func writeAttachments(b *strings.Builder, attachments []discord.Attachment) { for i := range attachments { + a := attachments[i] b.WriteString("\n") - b.WriteString(attachments[i].URL) + b.WriteString("[") + b.WriteString(a.Filename) + b.WriteString("]: ") + b.WriteString(a.URL) } }