This commit is contained in:
Atridad Lahiji 2024-01-19 16:04:05 -07:00
parent e283e65868
commit 4469788d91
No known key found for this signature in database
3 changed files with 3 additions and 8 deletions

View file

@ -102,14 +102,7 @@ func ReplicateImageGeneration(prompt string, filename string) (*bytes.Buffer, er
}
// Save image to a temporary file
var tmpfile *os.File
var err error
if filename != "" {
tmpfile, err = os.CreateTemp("", filename)
} else {
tmpfile, err = os.CreateTemp("", "image.*.jpg")
}
tmpfile, err := os.Create(filename)
if err != nil {
log.Fatal(err)

View file

@ -12,6 +12,7 @@ import (
func UploadToS3(filePath string) (*s3manager.UploadOutput, error) {
bucket := os.Getenv("BUCKET_NAME")
fmt.Println("The filepath is: ", filePath)
if bucket == "" {
fmt.Println("No S3 bucket specified, skipping upload.")
return nil, nil

View file

@ -189,6 +189,7 @@ func (h *handler) cmdPic(ctx context.Context, data cmdroute.CommandData) *api.In
// Concatenate clean username and timestamp to form filename
filename := data.Event.Sender().Username + "_" + timestamp + ".jpg"
fmt.Println("The filename is: ", filename)
imageFile, err := lib.ReplicateImageGeneration(options.Prompt, filename)