functional ttv-obfuscated-names

This commit is contained in:
zomo
2026-04-18 23:44:01 -05:00
parent aa25288f10
commit 3b8c402873
11 changed files with 894 additions and 0 deletions
@@ -0,0 +1,25 @@
import { NameConfigInstance, ignoreMod } from './options'
import { getRandomName, getStoredUser, setStoredUser } from './storage'
import { ChatMessage } from './util'
export function obfuscator(
chatMessage: ChatMessage
): NameConfigInstance | null {
if (ignoreMod && chatMessage.isMod) {
return null
}
chatMessage.username = chatMessage.username.toLowerCase()
// return stored data
const userData = getStoredUser(chatMessage.username)
if (userData !== null) {
return userData
}
// store new data
const newName = getRandomName()
setStoredUser(chatMessage.username, newName)
return newName
}