OpenClaw에 욕설 필터링을 추가하는 방법 | Moltbot Clawdbot Agent
I’m happy to help translate the article, but I’ll need the full text you’d like translated. Could you please paste the content (excluding the source line you already provided) here? Once I have it, I’ll translate it into Korean while preserving the original formatting, markdown, and any code blocks or URLs.
목차
- 문제: AI 기반 욕설 검사 비용이 높음
openclaw‑profanity는 왜?- 통합 옵션
- 옵션 1: Profanity Guard Hook
- 옵션 2: Custom Skill
- 옵션 3: Direct Integration
- 플랫폼별 예시
- 고급: 하이브리드 AI + 로컬 필터링
- 구성 옵션
- 빠른 시작
- FAQ
문제: AI 기반 욕설 검사 비용이 많이 듭니다
| 일일 메시지 수 | 월 비용 (AI 전용) | openclaw‑profanity 사용 시 |
|---|---|---|
| 500 | $5 – $15 | $0 |
| 1,000 | $10 – $30 | $0 |
| 5,000 | $50 – $150 | $0 |
| 10,000 | $100 – $300 | $0 |
이는 욕설 검사만을 위한 비용이며, 에이전트가 실제로 유용한 작업을 수행하기 전의 비용입니다.
AI 전용 모더레이션의 다른 문제점
| 문제 | AI 전용 | openclaw‑profanity |
|---|---|---|
| 지연 시간 | 검사당 200 – 500 ms | — |
agent.useHook(
profanityGuardHook({
action: "censor",
onViolation: (msg, result) => {
console.log(`Filtered: ${result.profaneWords.join(", ")}`);
}
})
);
agent.start();
통합 옵션
옵션 1: 욕설 방지 훅
모든 들어오는 메시지를 필터링하기 위해 단일 훅을 추가합니다.
옵션 2: 맞춤 스킬
checkProfanity를 호출하고 결과를 처리하는 방법을 결정하는 스킬을 만듭니다.
옵션 3: 직접 통합
메시지‑처리 파이프라인에서 Filter 클래스를 직접 사용합니다.
플랫폼‑Specific Examples
Telegram, Discord, Slack
같은 훅이 작동합니다; OpenClawAgent 생성자에서 어댑터(TelegramAdapter, DiscordAdapter, SlackAdapter)를 교체하기만 하면 됩니다.
고급: 하이브리드 AI + 로컬 필터링
경계 상황에 대해 저렴한 로컬 필터와 고정밀 AI 모델을 결합할 수 있습니다:
import { checkProfanity, censorText } from "openclaw-profanity";
async function handleIncomingMessage(message, context) {
// 1️⃣ Fast local check
const result = await checkProfanity(message.text);
if (result.isProfane && result.confidence > 0.9) {
// High confidence → block immediately
return context.reply("Please keep the conversation respectful.");
}
// Medium confidence → run a more expensive AI check (optional)
const aiResult = await aiProfanityCheck(message.text); // your AI call
if (aiResult.isProfane) {
return context.reply("Please keep the conversation respectful.");
}
// Otherwise, censor and continue
const censored = censorText(message.text);
message.text = censored.processedText;
// 3️⃣ Forward to the main LLM
return context.next(message);
}
구성 옵션
| 옵션 | 타입 | 기본값 | 설명 |
|---|---|---|---|
action | "censor" | "block" | "censor" | 금칙어가 감지될 때 수행할 작업 |
languages | string[] | ["en"] | 검사할 ISO‑639‑1 언어 코드 |
replacement | string | "***" | 금칙어를 대체할 텍스트 (action: "censor" 일 때) |
detectLeetspeak | boolean | true | 레트스피크(leet‑speak) 감지 활성화 |
detectUnicode | boolean | true | 유니코드 대체 감지 활성화 |
onViolation | (msg, result) => void | null | 위반이 발생할 때 호출되는 콜백 |
onError | (err) => void | null | 예기치 않은 오류에 대한 콜백 |
모든 옵션은 선택 사항이며, 기본값으로 바로 사용할 수 있습니다.
Quick Start
# 1️⃣ Install the package
npm i openclaw-profanity
// 2️⃣ Add the hook (3 lines of code)
import { OpenClawAgent } from "openclaw";
import { profanityGuardHook } from "openclaw-profanity/hooks";
const agent = new OpenClawAgent({ /* your config */ });
agent.useHook(profanityGuardHook({ action: "censor", languages: ["en"] }));
agent.start();
그게 전부입니다 — 이제 완전한 욕설 방지를 지연 시간 없이 그리고 추가 비용 없이 사용할 수 있습니다.
자주 묻는 질문
Q: 내 봇이 이미 GPT/Claude/Gemini를 사용하고 있어요. 왜 LLM에게 욕설 검사를 요청하지 않나요?
A: 각 검사는 API 지연 시간과 비용이 발생합니다. 로컬 필터는 대부분의 경우를 즉시 무료로 처리합니다.
Q: 검열 대신 메시지를 차단할 수 있나요?
A: 예. 훅이나 스킬 설정에서 action: "block"을 지정하세요.
Q: 새로운 언어 지원을 추가하려면 어떻게 해야 하나요?
A: glin-profanity 저장소에 언어 파일을 기여하거나 이슈를 열어 주세요. 이 라이브러리는 커뮤니티 확장을 염두에 두고 설계되었습니다.
Q: 필터가 이모지나 이미지에도 적용되나요?
A: 핵심 라이브러리는 텍스트만 처리합니다. 미디어의 경우, 추출된 텍스트를 checkProfanity에 전달하기 전에 OCR 단계가 필요합니다.
Q: 이 라이브러리를 프로덕션에 사용해도 안전한가요?
A: 다수의 고트래픽 봇에서 실전 테스트를 거쳤으며, 외부 의존성 없이 결정론적인 결과를 제공합니다.
📦 설치
npm install openclaw-profanity
🔧 빠른 설정 – Profanity Guard Hook 추가
import { profanityGuardHook } from "openclaw-profanity/hooks";
agent.useHook(
profanityGuardHook({
action: "censor" // or "block"
})
);
이제 모든 들어오는 메시지가 자동으로 필터링됩니다.
📱 플랫폼‑특정 예시
Telegram
import { OpenClawAgent } from "openclaw";
import { TelegramAdapter } from "openclaw/adapters/telegram";
import { profanityGuardHook } from "openclaw-profanity/hooks";
const agent = new OpenClawAgent({
adapter: new TelegramAdapter({
token: process.env.TELEGRAM_BOT_TOKEN
})
});
agent.useHook(
profanityGuardHook({
action: "block",
warningMessage: "Please keep the chat friendly!"
})
);
Discord
import { OpenClawAgent } from "openclaw";
import { DiscordAdapter } from "openclaw/adapters/discord";
import { profanityGuardHook } from "openclaw-profanity/hooks";
const agent = new OpenClawAgent({
adapter: new DiscordAdapter({
token: process.env.DISCORD_BOT_TOKEN
})
});
agent.useHook(
profanityGuardHook({
action: "censor",
// Discord‑specific: delete original and repost censored
onViolation: async (msg, result, context) => {
await msg.delete();
await context.reply(`${msg.author}: ${result.censoredText}`);
}
})
);
Slack
import { OpenClawAgent } from "openclaw";
import { SlackAdapter } from "openclaw/adapters/slack";
import { profanityGuardHook } from "openclaw-profanity/hooks";
const agent = new OpenClawAgent({
adapter: new SlackAdapter({
token: process.env.SLACK_BOT_TOKEN
})
});
agent.useHook(
profanityGuardHook({
action: "censor",
onViolation: async (msg, result) => {
// Notify workspace admins
await notifyAdmins(msg.channel, result);
}
})
);
⚡ 하이브리드 모더레이션 – 필요 시 빠른 로컬 + AI
import { checkProfanity } from "openclaw-profanity";
async function smartModeration(message, agent) {
// 1️⃣ Fast local check
const local = await checkProfanity(message.text);
if (local.isProfane && local.confidence > 0.95) {
return { action: "block" };
}
// 2️⃣ Uncertain → ask the LLM for context (rare)
const aiAnalysis = await agent.analyze({
prompt: `Is this message inappropriate? Consider context and intent: "${message.text}"`,
format: "json"
});
return aiAnalysis.inappropriate ? { action: "block" } : { action: "allow" };
}
결과
| Metric | Value |
|---|---|
| 즉시 결정 (로컬) | 95 % 메시지 중 |
| AI로 에스컬레이션 | 5 % (모호한 경우에만) |
| AI‑전용 대비 비용 절감 | 90 % 이상 |
| 평균 로컬 지연 시간 | sub‑ms |
🛠️ 고급 필터 구성
import { Filter } from "openclaw-profanity";
const filter = new Filter({
// Languages (default = all 24)
languages: ["en", "es", "fr"],
// Evasion detection
detectLeetspeak: true, // f4ck, sh1t
detectUnicode: true, // Cyrillic/Greek substitutions
detectSpacing: true, // f u c k
// Censorship options
replaceWith: "*", // character used for replacement
preserveLength: true, // "****" vs "***"
// Whitelist (words to ignore)
whitelist: ["assistant", "class"],
// Custom profanity list
customWords: ["badword1", "badword2"]
});
❓ 자주 묻는 질문
| 질문 | 답변 |
|---|---|
| 라이브러리가 실시간 봇에 충분히 빠른가요? | 예 – 서브밀리초 응답 시간 (원격 API보다 200‑500× 빠름). |
| “Scunthorpe”가 잘못 차단될까요? | 아니요. 엔진은 스마트 단어 경계 감지와 내장 화이트리스트를 사용합니다. |
| 내가 직접 단어를 추가할 수 있나요? | 물론입니다. customWords를 통해 추가하면 회피 탐지(리트스피크, 유니코드, 띄어쓰기 등)를 모두 상속합니다. |
| 이것이 이전 Moltbot/Clawdbot 라이브러리와 같은가요? | 예. OpenClaw가 새로운 이름이며, 통합 방식은 동일합니다. |
| 어떤 핵심 엔진이 사용되나요? | glin-profanity – 검증된 다국어 욕설 탐지 엔진. |
| 무료인가요? | 100 % 오픈소스, MIT‑licensed. API 비용 없음. |
| 지원되는 플랫폼은 무엇인가요? | Telegram, Discord, Slack, WhatsApp 및 OpenClaw‑compatible 채널 전반. |
| 몇 개의 언어를 지원하나요? | 기본 제공 24개 언어, 전체 유니코드 지원. |
| 다른 프레임워크와 함께 사용할 수 있나요? | 핵심 Filter 클래스를 어떤 Node.js 프로젝트에서도 직접 호출할 수 있습니다. |
🌟 주요 장점
- 무료 – 완전히 로컬에서 실행되며 외부 API 비용이 없습니다.
- 서브밀리초 지연 – 고처리량 봇에 이상적입니다.
- 24개 언어 다국어 지원.
- 우회 방지 – 리트스피크, 유니코드 트릭, 공백 문자 등.
- Native OpenClaw 통합 – 간단한 훅, 스킬 또는 직접 API 사용.
- MIT 라이선스 – 자유롭게 사용, 수정 및 재배포 가능.
📚 리소스
| 리소스 | 링크 |
|---|---|
| npm 패키지 | npm install openclaw-profanity |
| GitHub 저장소 | |
| 문서 / 통합 가이드 | |
| 실시간 데모 | |
| 관련 프로젝트 | - glin-profanity-mcp (Claude Desktop, Cursor, Windsurf용 MCP 서버) - glin-profanity (Flask/Django용 Python 버전) |
🙋♀️ 연락하기
- 질문이 있나요? 아래에 댓글을 남기거나 GitHub에서 이슈를 열어 주세요.
- 사용 사례? 어떤 메신저 플랫폼을 구축하고 있는지 알려 주세요 – 실제 적용 사례를 듣는 것을 좋아합니다!
당신의 봇은 $100+/월을 지불하며 욕설 검사를 하는 것보다 더 나은 대우를 받아야 합니다. 한 줄의 코드만 추가하면 영원히 해결됩니다.