1
0
mirror of https://github.com/toast-ts/Daggerbot-TS.git synced 2024-11-18 00:31:00 -05:00

Fucking hell, stop breaking yourself, you piece of shit.

This commit is contained in:
toast-ts 2024-04-01 23:09:23 +11:00
parent af829ff62a
commit c6d7f8e04c
2 changed files with 9 additions and 3 deletions

View File

@ -4,7 +4,7 @@ import Logger from '../helpers/Logger.js';
export default class Automoderator { export default class Automoderator {
private static logPrefix:string = 'Automod'; private static logPrefix:string = 'Automod';
private static lockQuery:Set<Discord.Snowflake> = new Set(); private static lockQuery:Set<Discord.Snowflake> = new Set();
static scanMsg =(message:Discord.Message)=>message.content.toLowerCase().replaceAll(/[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?\n?0-9]|ing\b|ed\b|es\b|er\b|$/g, '').split(' ').join(''); static scanMsg =(message:Discord.Message)=>message.content.toLowerCase().replaceAll(/[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?\n?0-9]|ing\b|ed\b|es\b|er\b/g, '').split('').join('');
static async repeatedMessages(client:TClient, message:Discord.Message, action:'mute'|'ban'|'softban', thresholdTime:number, thresholdAmount:number, type:string, duration:string, reason:string) { static async repeatedMessages(client:TClient, message:Discord.Message, action:'mute'|'ban'|'softban', thresholdTime:number, thresholdAmount:number, type:string, duration:string, reason:string) {
const now = Date.now(); const now = Date.now();

View File

@ -1,5 +1,5 @@
import DatabaseServer from '../components/DatabaseServer.js'; import DatabaseServer from '../components/DatabaseServer.js';
import {Model, DataTypes} from '@sequelize/core'; import {Model, DataTypes, Op} from '@sequelize/core';
class prohibitedWords extends Model { class prohibitedWords extends Model {
declare public word: string; declare public word: string;
@ -25,7 +25,13 @@ export class ProhibitedWordsSvc {
}) })
this.model.sync(); this.model.sync();
} }
findWord = async(word:string)=>await this.model.findByPk(word); findWord = async(word:string)=>{
const words = word.split(' ');
for (const w of words) {
const found = await this.model.findOne({where: {word: {[Op.eq]: w}}});
if (found) return true;
}
}
getAllWords = async()=>await this.model.findAll(); getAllWords = async()=>await this.model.findAll();
insertWord = async(word:string)=>await this.model.create({word}); insertWord = async(word:string)=>await this.model.create({word});
removeWord = async(word:string)=>await this.model.destroy({where: {word}}) removeWord = async(word:string)=>await this.model.destroy({where: {word}})