From 882de4b8ee84435b774b03bc615435b7ef6acf4c Mon Sep 17 00:00:00 2001 From: Elly <145195760+ellypaws@users.noreply.github.com> Date: Sat, 6 Jan 2024 08:38:47 +0800 Subject: [PATCH] Change timestamps to UTC and format `2006-01-02_15-04-05` --- imagine_queue/embed_helpers.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/imagine_queue/embed_helpers.go b/imagine_queue/embed_helpers.go index 824172a..acece1d 100644 --- a/imagine_queue/embed_helpers.go +++ b/imagine_queue/embed_helpers.go @@ -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, @@ -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()), @@ -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()),