Sfoglia il codice sorgente

filename uses proper message timestamp

get-got 4 anni fa
parent
commit
4512eec6eb
1 ha cambiato i file con 7 aggiunte e 1 eliminazioni
  1. 7 1
      downloads.go

+ 7 - 1
downloads.go

@@ -687,7 +687,13 @@ func tryDownload(inputURL string, filename string, path string, message *discord
 				filenameDateFormat = *channelConfig.OverwriteFilenameDateFormat
 			}
 		}
-		newFilename := time.Now().Format(filenameDateFormat) + filename
+		messageTime, err := message.Timestamp.Parse()
+		var newFilename string
+		if err == nil {
+			newFilename = messageTime.Format(filenameDateFormat) + filename
+		} else {
+			newFilename = time.Now().Format(filenameDateFormat) + filename
+		}
 		completePath := path + subfolder + newFilename
 
 		// Check if exists