From 68e63f8e39bb78b226621039e6fe535d9b9df133 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Sat, 6 Jan 2024 17:19:57 +0100 Subject: [PATCH] Show 'one contributor' instead of '1 contributors', hide thank you note if this is configured --- src/Config.ts | 6 ++++++ src/Postbuilder.ts | 10 ++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/Config.ts b/src/Config.ts index 472a3a1..b056ead 100644 --- a/src/Config.ts +++ b/src/Config.ts @@ -42,6 +42,10 @@ export interface MapCompleteUsageOverview { * If omitted: show all themes */ themeWhitelist?: string[] + /** + * Show a thank you note + */ + showThankYou?: boolean | true } @@ -64,4 +68,6 @@ export default interface Config { dryrun?: boolean }, actions: MapCompleteUsageOverview [] + + } \ No newline at end of file diff --git a/src/Postbuilder.ts b/src/Postbuilder.ts index 3f5fc64..3d78e63 100644 --- a/src/Postbuilder.ts +++ b/src/Postbuilder.ts @@ -157,13 +157,15 @@ export class Postbuilder { const images = await imageUploader.attemptToUpload(4) const authors = Array.from(new Set(imageUploader.getCurrentAuthors())) if (authors.length > 0) { + let imageCount = totalImagesCreated === 1 ? "one image" : totalImagesCreated + " images" + let contributors = totalImageContributorCount === 1 ? "One contributor": totalImageContributorCount+" contributors" + let contributorCountMultiple = `${contributors} uploaded ${imageCount}.` + let thankYou = (this._config.showThankYou ?? true) ? "\nA big thanks to everyone who is contributing!\n\n" : "" await this._poster.writeMessage([ - "In total, " + totalImageContributorCount + " different contributors uploaded " + totalImagesCreated + " images.\n", + contributorCountMultiple + "\n", "Images in this thread are randomly selected from them and were made by: ", ...authors, - "", - "A big thanks to everyone who is contributing!", - "", + thankYou, "All changes were made on " + date + (this._config.numberOfDays > 1 ? ` or at most ${this._config.numberOfDays} days before` : "") ].join("\n"), {