Skip to content

Commit

Permalink
Change timestamps to UTC and format 2006-01-02_15-04-05
Browse files Browse the repository at this point in the history
  • Loading branch information
ellypaws committed Jan 6, 2024
1 parent ff125c2 commit 882de4b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions imagine_queue/embed_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ func imageEmbedFromBuffers(webhook *discordgo.WebhookEdit, embed *discordgo.Mess
if webhook == nil {
return errors.New("imageEmbedFromBuffers called with nil webhook")
}
now := time.Now()
now := time.Now().UTC()
nowFormatted := now.Format("2006-01-02_15-04-05")
if embed == nil {
embed = &discordgo.MessageEmbed{
Type: discordgo.EmbedTypeImage,
Expand Down Expand Up @@ -165,7 +166,7 @@ func imageEmbedFromBuffers(webhook *discordgo.WebhookEdit, embed *discordgo.Mess
if err != nil {
return fmt.Errorf("error tiling primary images: %w", err)
}
imgName := fmt.Sprintf("%v.png", now.Format("2006-01-02-Z15-00"))
imgName := fmt.Sprintf("%v.png", nowFormatted)
files = append(files, &discordgo.File{
Name: imgName,
Reader: bytes.NewReader(primaryTile.Bytes()),
Expand All @@ -181,7 +182,7 @@ func imageEmbedFromBuffers(webhook *discordgo.WebhookEdit, embed *discordgo.Mess
continue
}

imgName := fmt.Sprintf("%v-%d.png", now.Format("2006-01-02-Z15-00"), i)
imgName := fmt.Sprintf("%v-%d.png", nowFormatted, i)
files = append(files, &discordgo.File{
Name: imgName,
Reader: bytes.NewReader(imgBuf.Bytes()),
Expand Down

0 comments on commit 882de4b

Please sign in to comment.