Don't post author credits if no images are added

This commit is contained in:
Pieter Vander Vennet 2023-01-20 04:35:52 +01:00
parent 28f34bea6d
commit 750c76c80e

View file

@ -337,19 +337,21 @@ export class Postbuilder {
const images = await imageUploader.attemptToUpload(4) const images = await imageUploader.attemptToUpload(4)
const authors = Array.from(new Set(imageUploader.getCurrentAuthors())) const authors = Array.from(new Set(imageUploader.getCurrentAuthors()))
await this._poster.writeMessage([ if(authors.length > 0){
"In total, " + totalImageContributorCount + " different contributors uploaded " + totalImagesCreated + " images.\n", await this._poster.writeMessage([
"Images in this thread are randomly selected from them and were made by: ", "In total, " + totalImageContributorCount + " different contributors uploaded " + totalImagesCreated + " images.\n",
...authors.map(auth => "- " + auth), "Images in this thread are randomly selected from them and were made by: ",
"", ...authors.map(auth => "- " + auth),
"All changes were made on " + date + (this._config.numberOfDays > 1 ? ` or at most ${this._config.numberOfDays} days before` : "") "",
"All changes were made on " + date + (this._config.numberOfDays > 1 ? ` or at most ${this._config.numberOfDays} days before` : "")
].join("\n"), {
inReplyToId: lastPostId, ].join("\n"), {
mediaIds: images, inReplyToId: lastPostId,
spoilerText: this._config.contentWarning mediaIds: images,
} spoilerText: this._config.contentWarning
) }
)
}
} }