1
0
mirror of https://github.com/toast-ts/Daggerbot-TS.git synced 2024-11-16 20:00:59 -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 651f44a883
commit c2f7b2c44a
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 {
private static logPrefix:string = 'Automod';
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) {
const now = Date.now();

View File

@ -1,5 +1,5 @@
import DatabaseServer from '../components/DatabaseServer.js';
import {Model, DataTypes} from '@sequelize/core';
import {Model, DataTypes, Op} from '@sequelize/core';
class prohibitedWords extends Model {
declare public word: string;
@ -25,7 +25,13 @@ export class ProhibitedWordsSvc {
})
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();
insertWord = async(word:string)=>await this.model.create({word});
removeWord = async(word:string)=>await this.model.destroy({where: {word}})