move filter up
This commit is contained in:
parent
aca38d2924
commit
fc5f7fdc82
1 changed files with 8 additions and 7 deletions
15
src/index.ts
15
src/index.ts
|
@ -11,8 +11,6 @@ import { commands } from './commands';
|
||||||
import { filterMessage } from './filters';
|
import { filterMessage } from './filters';
|
||||||
import { parseLog } from './logs';
|
import { parseLog } from './logs';
|
||||||
|
|
||||||
import { green, bold, blue, underline, yellow } from 'kleur/colors';
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
parse as discordParse,
|
parse as discordParse,
|
||||||
type SuccessfulParsedMessage,
|
type SuccessfulParsedMessage,
|
||||||
|
@ -21,7 +19,9 @@ import {
|
||||||
import { readFile } from 'fs/promises';
|
import { readFile } from 'fs/promises';
|
||||||
import { join } from 'path';
|
import { join } from 'path';
|
||||||
|
|
||||||
|
import { green, bold, blue, underline, yellow } from 'kleur/colors';
|
||||||
import 'dotenv/config';
|
import 'dotenv/config';
|
||||||
|
|
||||||
export interface Command {
|
export interface Command {
|
||||||
name: string;
|
name: string;
|
||||||
aliases?: string[];
|
aliases?: string[];
|
||||||
|
@ -93,6 +93,11 @@ client.once('ready', async () => {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const messageIsOK = await filterMessage(e);
|
||||||
|
if (!messageIsOK) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const commanded = await parseMsg(e);
|
const commanded = await parseMsg(e);
|
||||||
if (commanded) return;
|
if (commanded) return;
|
||||||
|
|
||||||
|
@ -101,11 +106,6 @@ client.once('ready', async () => {
|
||||||
e.reply({ embeds: [log] });
|
e.reply({ embeds: [log] });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const filtered = await filterMessage(e);
|
|
||||||
if (!filtered) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -138,6 +138,7 @@ async function parseMsg(e: Message) {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await cmd.exec(e, parsed);
|
await cmd.exec(e, parsed);
|
||||||
} catch (err: unknown) {
|
} catch (err: unknown) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue