욕설 필터 플러그인 배포 #미스키_플러그인 #미스키플러그인

/// @ 0.12.5
### {
	name: "욕설 필터 플러그인",
	author: "@guiltyone@buttersc.one",
	version: "1.0.0",
	description: "욕설을 전부 동그라미로 대체",
	permissions: [],
	config: { 
		debug: {
			type: "boolean",
			label: "디버그 모드",
			description: "디버그를 위해 필터링 로그를 출력합니다.",
			default: false
		}
	}
}

@debugLog(text) {
	if (Plugin:config.debug == true) {
		print(text)
	}
}

@filterBadWords(note) {
	let badWords = [
		['씨발', '○○'],
		['시발', '○○'],
		['ㅅㅂ', '○○'],
		['좆', '○○'],
		['썅', '○'],
		['씹', '○'],
		['개새끼', '○○○'],
		['미친년', '미친○'],
		['미친놈', '미친○'],
		['씨팔', '○○'],
		['존나', '겁나'],
		['줫나', '겁나'],
		['전나', '겁나'],
		['줜나', '겁나'],
		['지랄', '○○'],
		['븅신', '바부'],
		['병신', '○○'],
		['십발', '○○'],
		['부랄', '○○'],
		['씨벌', '○○'],
		['씨방', '○○'],
		['앰창', '○○'],
		['앱창', '○○'],
		['엠창', '○○'],
		['니미럴', '○○○'],
		['염병', '○○'],
		['옘병', '○○'],
		['쪽바리', '○○○'],
		['짱깨', '○○'],
		['짱꺠', '○○'],
		['짱꼴라', '○○○'],
		['쪽발이', '○○○'],
	]
	
	// 변경 가능한 변수로 선언
	var filtered = false

	each (let pair, badWords) {
		let pattern = pair[0]
		let replacement = pair[1]

		let newText = note.text.replace(pattern, replacement)
		if (newText != note.text) {
			debugLog(`욕설 감지됨: "${pattern}", 대체: "${replacement}"`)
			note.text = newText
			filtered = true
		}
	}

	if (filtered) {
		debugLog(`노트 필터링 완료: ${note.text}`)
	}
}

@applyFilter(note) {
	if (note.text != null) {
		filterBadWords(note)
	}

	if (note.reply != null) {
		applyFilter(note.reply)
	}

	if (note.renote != null) {
		applyFilter(note.renote)
	}

	if (note.quote != null) {
		applyFilter(note.quote)
	}
}

@handler(note_) {
	let note = note_

	applyFilter(note)

	return note
}

Plugin:register_note_view_interruptor(handler)

사용 방법: 해당 코드를 복사 - [설정]의 [플러그인]으로 들어가 [플러그인 설치]를 누르고 빈 칸에 붙여넣기 후 저장

기본적인 욕설은 다 넣어놨지만 데이터베이스에서 자신이 원하는 대로 추가 및 제거 해도 됩니다

0

If you have a fediverse account, you can quote this note from your own instance. Search https://buttersc.one/notes/a161sw093s on your instance and quote it. (Note that quoting is not supported in Mastodon.)