diff --git a/internal/nzcovidbot/csv.go b/internal/nzcovidbot/csv.go index 2447e5e..1525e83 100644 --- a/internal/nzcovidbot/csv.go +++ b/internal/nzcovidbot/csv.go @@ -45,7 +45,8 @@ func formatCsvDiscordRow(data string) string { c := make([]string, 0) c = append(c, fields...) - return fmt.Sprintf("**%s** %s on _%s_ - _%s_", c[1], c[2], c[4], c[5]) + endtime := strings.Split(c[5], ", ") + return fmt.Sprintf("**%s** %s on _%s_ - _%s_", c[1], c[2], c[4], endtime[1]) } // formatCsvTwitterRow Format the string to a tidy string for the interwebs @@ -61,7 +62,8 @@ func formatCsvTwitterRow(data string) string { c := make([]string, 0) c = append(c, fields...) - return fmt.Sprintf("**%s** - %s\n_%s_ - _%s_", c[1], c[2], c[4], c[5]) + endtime := strings.Split(c[5], ", ") + return fmt.Sprintf("**%s** - %s _%s_ - _%s_", c[1], c[2], c[4], endtime[1]) } func getPostableDiscordData() string { @@ -78,7 +80,7 @@ func getPostableDiscordData() string { } } - return strings.Join(rows, "\n\n") + return strings.Join(rows, "\n") } func getPostableTwitterData() string { diff --git a/internal/nzcovidbot/discord.go b/internal/nzcovidbot/discord.go index 10d6cc1..c35ae42 100644 --- a/internal/nzcovidbot/discord.go +++ b/internal/nzcovidbot/discord.go @@ -22,25 +22,14 @@ func postToDiscord(webhookString string, msg string) { return } - // message, err := webhook.SendContent(msg) - // if err != nil { - // log.Print(err) - // return - // } - - // // message, err = webhook.SendEmbeds(api.NewEmbedBuilder(). - // // SetDescription(msg). - // // Build(), - // // ) - // if err != nil { - // log.Print(err) - // return - // } - - _, err = webhook.SendMessage(api.NewWebhookMessageCreateBuilder(). - SetContent(msg). + _, err = webhook.SendEmbeds(api.NewEmbedBuilder(). + SetDescription(msg). Build(), ) + if err != nil { + log.Print(err) + return + } if err != nil { log.Print(err)