Skip to content

Commit

Permalink
Fix multiple tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexProgrammerDE committed Sep 30, 2023
1 parent f78db85 commit bcbf547
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions modules/checks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,19 +83,23 @@ export default (client: Client): void => {
})
}

async function respondToText (message: Message, text: string, footer: string) {
for (const test of config.tests) {
let cause: RegExpExecArray | null = null
for (const check of test.checks) {
console.log(`Checking ${check} against ${text}`)
const match = check.exec(text)
if (match != null) {
cause = match
}
function checkMatch (text: string, checks: RegExp[]) {
for (const check of checks) {
console.log(`Checking ${check} against ${text}`)
const match = check.exec(text)
if (match != null) {
return match
}
}

return null
}

async function respondToText (message: Message, text: string, footer: string) {
for (const test of config.tests) {
let cause = checkMatch(text, test.checks)
if (cause == null) {
return
continue
}

const embed = new EmbedBuilder()
Expand Down

0 comments on commit bcbf547

Please sign in to comment.