Fixing Noah's project package and removing Words.json from the cache
This commit is contained in:
parent
bce2bf234e
commit
ba5b14c05a
3
.gitignore
vendored
3
.gitignore
vendored
@ -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
|
16
src/utilties/discord/regex_matching.ts
Normal file
16
src/utilties/discord/regex_matching.ts
Normal 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)
|
||||||
|
}
|
@ -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) => {
|
||||||
|
@ -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[] = [
|
||||||
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
BIN
tools/profanity_filter/bin/generators/ExceptionGenerator.class
Normal file
BIN
tools/profanity_filter/bin/generators/ExceptionGenerator.class
Normal file
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@ -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) {
|
||||||
|
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user