Fix line endings

This commit is contained in:
Tarrgon
2026-05-29 08:43:48 -04:00
parent 66d4bd4926
commit 6ad3ee5f23
98 changed files with 6528 additions and 6528 deletions
+37 -37
View File
@@ -1,38 +1,38 @@
import { Ticket, TicketPhrase } from '../types';
function friendlyPhrase(phrase: string): string {
switch (phrase) {
case 'underage porn':
case 'child porn':
case 'cp':
return 'Code Red';
default:
return phrase;
}
}
export function shouldAlert(ticketPhrase: TicketPhrase, ticket: Ticket): { alert: boolean, match?: string } {
if (!(ticketPhrase.phrase.startsWith('/') && ticketPhrase.phrase.endsWith('/'))) {
if (ticket.reason.toLowerCase().includes(ticketPhrase.phrase.toLowerCase())) {
return { alert: true, match: friendlyPhrase(ticketPhrase.phrase.trim()) };
} else {
return { alert: false };
}
} else {
try {
const regex = new RegExp(ticketPhrase.phrase.slice(1, -1), 'i');
const regexMatch = regex.exec(ticket.reason);
if (regexMatch) {
return { alert: true, match: `${friendlyPhrase(regexMatch[0].trim())} (RegEx match: \`${ticketPhrase.phrase}\`)` };
} else {
return { alert: false };
}
} catch (e) {
console.error(e);
return { alert: false };
}
}
import { Ticket, TicketPhrase } from '../types';
function friendlyPhrase(phrase: string): string {
switch (phrase) {
case 'underage porn':
case 'child porn':
case 'cp':
return 'Code Red';
default:
return phrase;
}
}
export function shouldAlert(ticketPhrase: TicketPhrase, ticket: Ticket): { alert: boolean, match?: string } {
if (!(ticketPhrase.phrase.startsWith('/') && ticketPhrase.phrase.endsWith('/'))) {
if (ticket.reason.toLowerCase().includes(ticketPhrase.phrase.toLowerCase())) {
return { alert: true, match: friendlyPhrase(ticketPhrase.phrase.trim()) };
} else {
return { alert: false };
}
} else {
try {
const regex = new RegExp(ticketPhrase.phrase.slice(1, -1), 'i');
const regexMatch = regex.exec(ticket.reason);
if (regexMatch) {
return { alert: true, match: `${friendlyPhrase(regexMatch[0].trim())} (RegEx match: \`${ticketPhrase.phrase}\`)` };
} else {
return { alert: false };
}
} catch (e) {
console.error(e);
return { alert: false };
}
}
}