@fsvreddit/bot-bouncer-evaluation 0.7.49 → 0.7.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -12,6 +12,7 @@ const zod_1 = __importDefault(require("zod"));
|
|
|
12
12
|
const zod_js_1 = require("openai/helpers/zod.js");
|
|
13
13
|
const constants_js_1 = require("../constants.js");
|
|
14
14
|
const wordcount_1 = require("@wordpress/wordcount");
|
|
15
|
+
const commonWords_js_1 = require("../commonWords.js");
|
|
15
16
|
class EvaluateRepostBot extends UserEvaluatorBase_js_1.UserEvaluatorBase {
|
|
16
17
|
constructor() {
|
|
17
18
|
super(...arguments);
|
|
@@ -129,12 +130,23 @@ class EvaluateRepostBot extends UserEvaluatorBase_js_1.UserEvaluatorBase {
|
|
|
129
130
|
const sortedPosts = posts.sort((a, b) => b.createdAt.getTime() - a.createdAt.getTime());
|
|
130
131
|
const latestPost = sortedPosts[0];
|
|
131
132
|
// Look for duplicate posts.
|
|
132
|
-
|
|
133
|
+
let postDuplicates = await this.context.reddit.searchPosts({
|
|
133
134
|
query: `title:"${latestPost.title}"`,
|
|
134
135
|
subredditName: latestPost.subredditName,
|
|
135
136
|
sort: "new",
|
|
136
137
|
limit: 100,
|
|
137
138
|
}).all().then(posts => posts.filter(post => this.isEligiblePost(post) && post.title === latestPost.title && post.authorName !== latestPost.authorName));
|
|
139
|
+
if (postDuplicates.length === 0) {
|
|
140
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
141
|
+
if (this.getVariable("allowSimilarTitles", false)) {
|
|
142
|
+
postDuplicates = await this.context.reddit.searchPosts({
|
|
143
|
+
query: (0, commonWords_js_1.getLeastCommonWordsFromText)(latestPost.title, { take: 3 }).join(" "),
|
|
144
|
+
subredditName: latestPost.subredditName,
|
|
145
|
+
sort: "hot",
|
|
146
|
+
limit: 10,
|
|
147
|
+
}).all().then(posts => posts.filter(post => this.isEligiblePost(post) && post.score > 500 && post.authorName !== latestPost.authorName));
|
|
148
|
+
}
|
|
149
|
+
}
|
|
138
150
|
if (postDuplicates.length === 0) {
|
|
139
151
|
return false;
|
|
140
152
|
}
|
|
@@ -24,4 +24,5 @@ export * from "./EvaluateTitleCopyBot.js";
|
|
|
24
24
|
export * from "./EvaluateWorldTraveller.js";
|
|
25
25
|
export * from "./EvaluateBotGroupSubmitters.js";
|
|
26
26
|
export * from "./EvaluateRedgifs.js";
|
|
27
|
+
export * from "./EvaluateRepostBot.js";
|
|
27
28
|
export * from "./UserEvaluatorBase.js";
|
|
@@ -40,4 +40,5 @@ __exportStar(require("./EvaluateTitleCopyBot.js"), exports);
|
|
|
40
40
|
__exportStar(require("./EvaluateWorldTraveller.js"), exports);
|
|
41
41
|
__exportStar(require("./EvaluateBotGroupSubmitters.js"), exports);
|
|
42
42
|
__exportStar(require("./EvaluateRedgifs.js"), exports);
|
|
43
|
+
__exportStar(require("./EvaluateRepostBot.js"), exports);
|
|
43
44
|
__exportStar(require("./UserEvaluatorBase.js"), exports);
|
package/package.json
CHANGED