Skip to content

Commit

Permalink
Merge pull request #23 from Rabenherz112/dev
Browse files Browse the repository at this point in the history
Update Dependencies & Add Spam Prevention
  • Loading branch information
Rabenherz112 authored Dec 27, 2022
2 parents e0860a5 + 4a026d6 commit 1dfe2c8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
13 changes: 11 additions & 2 deletions functions/util_checkReddit.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,17 @@ async function getPostsData(allPosts) {
if (blacklisted) {
continue;
}
let postDataId = post.data.id;
let subreddit = post.data.subreddit;
// Put the 3 latest Post Titles into the subreddit DB
await client.db.push(`${post.data.subreddit}.latestPosts`, postDataTitel.toLowerCase());
let latestPosts = await client.db.get(`${post.data.subreddit}.latestPosts`);
if (latestPosts.length > 3) {
await client.db.shift(`${post.data.subreddit}.latestPosts`);
}
// Check if current Post Data Title is already in the DB
latestPosts = await client.db.get(`${post.data.subreddit}.latestPost`);
if (latestPosts.includes(postDataTitel.toLowerCase())) {
continue;
}
// Check for Launcher
let postDataLauncher = post.data.title.match(/^\[([a-zA-Z0-9 \.]+)(?:[\/, ]*[a-zA-Z0-9\. ]*)*\]+.*$/mi);
if (postDataLauncher != null && typeof postDataLauncher === 'object' && postDataLauncher.length > 1) {
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
"homepage": "https://github.com/Rabenherz112/Discord-Bot-Free-Games-Finder#readme",
"dependencies": {
"better-sqlite3": "^8.0.1",
"discord-api-types": "^0.37.21",
"discord-api-types": "^0.37.24",
"discord.js": "^14.7.1",
"fs": "^0.0.1-security",
"html-entities": "^2.3.3",
"quick.db": "^9.0.7"
"quick.db": "^9.0.8"
}
}

0 comments on commit 1dfe2c8

Please sign in to comment.