Fixing Noah's project package and removing Words.json from the cache

This commit is contained in:
Bradley Bickford 2025-07-12 21:16:13 -04:00
parent bce2bf234e
commit ba5b14c05a
11 changed files with 27 additions and 3382 deletions

3
.gitignore vendored
View File

@ -1,3 +1,4 @@
node_modules node_modules
.env .env
tools/ProfanityFilter/src/Words.json tools/profanity_filter/bin/Words.json
tools/profanity_filter/src/Words.json

View File

@ -0,0 +1,16 @@
import { Guild } from "discord.js";
import { SQLCommon } from "../storage/interfaces";
export async function getRegexesForGuild(db: SQLCommon, guild: Guild): Promise<any[]> {
return db.getAllParameterized(
"SELECT * FROM message_regexes WHERE server_snowflake = ?",
[guild.id]
)
}
export async function getRoleExclusionSnowflakesForGuild(db: SQLCommon, guild: Guild): Promise<string[]> {
return (await db.getAllParameterized(
"SELECT role_snowflake FROM message_regex_no_role_check WHERE server_snowflake = ?",
[guild.id]
)).map((o) => (o as any).role_snowflake)
}

View File

@ -7,7 +7,7 @@ import { insertAttachment, insertMessage, markMessageDeleted, updateMessageConte
export function setupMessageCapture(client: Client, db: SQLCommon) { export function setupMessageCapture(client: Client, db: SQLCommon) {
client.on(Events.MessageCreate, async (message) => { client.on(Events.MessageCreate, async (message) => {
processMessageCreate(db, message) await processMessageCreate(db, message)
}) })
client.on(Events.MessageUpdate, async (oldMessage, newMessage) => { client.on(Events.MessageUpdate, async (oldMessage, newMessage) => {

View File

@ -8,7 +8,11 @@ const tables: string[] = [
"CREATE TABLE IF NOT EXISTS message_content_changes (message_change_id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,message_snowflake bigint NOT NULL,message_change_old_timestamp datetime NOT NULL,message_change_old_content longtext NOT NULL);", "CREATE TABLE IF NOT EXISTS message_content_changes (message_change_id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,message_snowflake bigint NOT NULL,message_change_old_timestamp datetime NOT NULL,message_change_old_content longtext NOT NULL);",
"CREATE TABLE IF NOT EXISTS message_attachments (attachment_snowflake bigint NOT NULL PRIMARY KEY,message_snowflake bigint NOT NULL,attachment_name text NOT NULL,attachment_description text,attachment_timestamp datetime NOT NULL,attachment_mime_type text,attachment_url text NOT NULL,attachment_downloaded bit NOT NULL);", "CREATE TABLE IF NOT EXISTS message_attachments (attachment_snowflake bigint NOT NULL PRIMARY KEY,message_snowflake bigint NOT NULL,attachment_name text NOT NULL,attachment_description text,attachment_timestamp datetime NOT NULL,attachment_mime_type text,attachment_url text NOT NULL,attachment_downloaded bit NOT NULL);",
"CREATE TABLE IF NOT EXISTS breadthread_autolock (breadthread_autolock_id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,channel_snowflake bigint NOT NULL,inactivity_seconds bigint NOT NULL,locked bit NOT NULL);", "CREATE TABLE IF NOT EXISTS breadthread_autolock (breadthread_autolock_id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,channel_snowflake bigint NOT NULL,inactivity_seconds bigint NOT NULL,locked bit NOT NULL);",
"CREATE TABLE IF NOT EXISTS roles (role_snowflake bigint NOT NULL PRIMARY KEY,server_snowflake bigint NOT NULL,role_name text NOT NULL,is_deleted bit NOT NULL);" "CREATE TABLE IF NOT EXISTS roles (role_snowflake bigint NOT NULL PRIMARY KEY,server_snowflake bigint NOT NULL,role_name text NOT NULL,is_deleted bit NOT NULL);",
"CREATE TABLE IF NOT EXISTS message_scan_regex_matches (message_scan_regex_matches_id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,message_snowflake bigint NOT NULL,message_regexes_id bigint NOT NULL);",
"CREATE TABLE IF NOT EXISTS message_regex_no_role_check (message_regex_no_role_check_id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,server_snowflake bigint NOT NULL,role_snowflake bigint NOT NULL);",
"CREATE TABLE IF NOT EXISTS message_regexes (message_regexes_id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,server_snowflake bigint NOT NULL,regex text NOT NULL,priority int NOT NULL,severity int NOT NULL);",
"CREATE TABLE IF NOT EXISTS message_regex_words (message_regex_words_id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,message_regexes_id bigint,word text NOT NULL);"
] ]
const constraints: string[] = [ const constraints: string[] = [

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
package tools.profanityFilter.src; package generators;
public class ExceptionGenerator { public class ExceptionGenerator {
public static void main(String[] args) { public static void main(String[] args) {

View File

@ -1,3 +1,5 @@
package generators;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;