@fsvreddit/bot-bouncer-evaluation 0.7.48 → 0.7.50
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.
|
@@ -131,10 +131,13 @@ class EvaluateRedgifs extends UserEvaluatorBase_1.UserEvaluatorBase {
|
|
|
131
131
|
if (this.getComments({ since: (0, date_fns_1.subDays)(new Date(), noCommentsBeforeDays) }).length > 0) {
|
|
132
132
|
return false;
|
|
133
133
|
}
|
|
134
|
-
const recentPosts = this.getPosts({ since: (0, date_fns_1.subDays)(new Date(), lookbackDays) });
|
|
134
|
+
const recentPosts = this.getPosts({ since: (0, date_fns_1.subDays)(new Date(), lookbackDays) }).filter(post => !post.removedByCategory);
|
|
135
135
|
if (recentPosts.some(post => !this.getRedgifsVideoIdFromUrl(post.url))) {
|
|
136
136
|
return false;
|
|
137
137
|
}
|
|
138
|
+
if (recentPosts.some(post => post.crosspostParentId)) {
|
|
139
|
+
return false;
|
|
140
|
+
}
|
|
138
141
|
if (recentPosts.length < minRedgifsPostsNeeded) {
|
|
139
142
|
return false;
|
|
140
143
|
}
|
|
@@ -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
|
}
|
package/package.json
CHANGED