Enhance bot functionality with AutoMod, Logging, Welcome, and Verification features
- Implemented AutoMod capabilities including spam filtering, anti-raid, and anti-nuke actions. - Added Logging module to track moderation actions and events across the bot. - Introduced Welcome module for customizable welcome messages and autoroles. - Developed Verification system with captcha and role assignment features. - Updated Prisma schema to include new models for AutoMod, Logging, Welcome, and Verification. - Enhanced command localization for new features in both German and English. - Improved health server to handle captcha verification requests. - Added new environment variable for public base URL to support captcha links.
This commit is contained in:
42
packages/shared/src/phase2.test.ts
Normal file
42
packages/shared/src/phase2.test.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import {
|
||||
applyWelcomePlaceholders,
|
||||
capsRatio,
|
||||
countEmojis,
|
||||
hasZalgo,
|
||||
isDiscordInvite,
|
||||
normalizeHost
|
||||
} from './phase2.js';
|
||||
|
||||
describe('phase2 helpers', () => {
|
||||
it('replaces welcome placeholders', () => {
|
||||
const result = applyWelcomePlaceholders('Hello {user} on {server}', {
|
||||
user: '<@1>',
|
||||
server: 'Nexumi'
|
||||
});
|
||||
expect(result).toBe('Hello <@1> on Nexumi');
|
||||
});
|
||||
|
||||
it('detects discord invites', () => {
|
||||
expect(isDiscordInvite('join https://discord.gg/test')).toBe(true);
|
||||
expect(isDiscordInvite('hello world')).toBe(false);
|
||||
});
|
||||
|
||||
it('calculates caps ratio', () => {
|
||||
expect(capsRatio('HELLO WORLD')).toBeGreaterThan(50);
|
||||
expect(capsRatio('hello')).toBe(0);
|
||||
});
|
||||
|
||||
it('counts emojis', () => {
|
||||
expect(countEmojis('hello 😀😀')).toBe(2);
|
||||
});
|
||||
|
||||
it('detects zalgo text', () => {
|
||||
expect(hasZalgo('h\u0305e\u0305l\u0305l\u0305o\u0305')).toBe(true);
|
||||
expect(hasZalgo('hello')).toBe(false);
|
||||
});
|
||||
|
||||
it('normalizes hostnames', () => {
|
||||
expect(normalizeHost('https://www.Example.com/path')).toBe('example.com');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user