From 3b7a79573ba0fa32807e502a795e1377d6da6b7e Mon Sep 17 00:00:00 2001 From: Sam Therapy Date: Sat, 8 Jan 2022 14:02:56 -0600 Subject: [PATCH] Fix NSFW directory Signed-off-by: Sam Therapy --- src/local.ts | 8 +++++--- tsconfig.json | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/local.ts b/src/local.ts index 1896a08..699e20a 100644 --- a/src/local.ts +++ b/src/local.ts @@ -83,9 +83,9 @@ let image: fs.ReadStream; let sensitivity: boolean; if (random >= sfw_files.length) { // Image is NSFW, mark it sensitive - image = fs.createReadStream(args.directory + "/nsfw" + nsfw_files[ random - sfw_files.length ]) + image = fs.createReadStream(args.directory + "/nsfw/" + nsfw_files[ random - sfw_files.length ]) .on("error", (err: Error) => { - console.log("Error reading image from NSFW directory: " + err.message); + console.error("Error reading image from NSFW directory: " + err.message); if (args.verbose) { console.error("--BEGIN FULL ERROR--"); console.error(err); @@ -99,7 +99,7 @@ else { // Image is SFW, mark it not sensitive image = fs.createReadStream(args.directory + "/sfw/" + sfw_files[ random ]) .on("error", (err: Error) => { - console.log("Error reading image from SFW directory:" + err.message); + console.error("Error reading image from SFW directory:" + err.message); if (args.verbose) { console.error("--BEGIN FULL ERROR--"); console.error(err); @@ -112,6 +112,8 @@ else { const client = generator(data.type, data.instance, data.accessToken); client.uploadMedia(image).then((res: Response) => { + if (args.verbose) + console.log(res.data); client.postStatus(args.message, { media_ids: [ res.data.id ], visibility: "unlisted", diff --git a/tsconfig.json b/tsconfig.json index 208e24f..409db45 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -15,8 +15,9 @@ // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ // "composite": true, /* Enable project compilation */ "removeComments": true, /* Do not emit comments to output. */ + "forceConsistentCasingInFileNames": true, /* Disallow inconsistently-cased references to the same file. */ // "noEmit": true, /* Do not emit outputs. */ - // "importHelpers": true, /* Import emit helpers from 'tslib'. */ + "importHelpers": true, /* Import emit helpers from 'tslib'. */ "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */