Use discord embeds

This commit is contained in:
Daniel Mason 2021-09-01 21:37:02 +12:00
parent 3fc389f1d6
commit df3c0b9ed4
Signed by: idanoo
GPG key ID: 387387CDBC02F132
2 changed files with 11 additions and 20 deletions

View file

@ -45,7 +45,8 @@ func formatCsvDiscordRow(data string) string {
c := make([]string, 0) c := make([]string, 0)
c = append(c, fields...) 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 // 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 := make([]string, 0)
c = append(c, fields...) 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 { func getPostableDiscordData() string {
@ -78,7 +80,7 @@ func getPostableDiscordData() string {
} }
} }
return strings.Join(rows, "\n\n") return strings.Join(rows, "\n")
} }
func getPostableTwitterData() string { func getPostableTwitterData() string {

View file

@ -22,25 +22,14 @@ func postToDiscord(webhookString string, msg string) {
return return
} }
// message, err := webhook.SendContent(msg) _, err = webhook.SendEmbeds(api.NewEmbedBuilder().
// if err != nil { SetDescription(msg).
// 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).
Build(), Build(),
) )
if err != nil {
log.Print(err)
return
}
if err != nil { if err != nil {
log.Print(err) log.Print(err)