file description module import type { Message , TextChannel } from "eris" ; const regexCache = { } ; export function wordFilter ( guildconfig , msg ) { if ( ! guildconfig ?. filteredWords || ! msg . content ) return ; const filteredWord = guildconfig ?. filteredWords . every ( ( word ) => { let regex = regexCache [ word ] ; if ( ! regex ) { regexCache [ word ] = new RegExp ( `\\b${ word }\\b` , "i" ) ; regex = regexCache [ word ] ; } return ! regex . test ( msg . content ) ; } ) ; if ( ! filteredWord ) msg . delete ( ) ; }