!LILY was conflicting with BCX

This commit is contained in:
Mute 2024-07-10 01:58:29 +00:00
parent f63826a1b0
commit 43463171e2

View File

@ -51,7 +51,7 @@
}
/** @type {LILY.Belt} */ const Belt = {
admins: [71_240, 67_994],
cli: {'!LILY': {
cli: {'#LILY': {
status: _ => '200 OK',
box: {
on: _ => Box.enable(),
@ -67,7 +67,6 @@
/** @type {LILY.Belt['is_cb']} */ is_cb: s => typeof s === 'function',
run(tokens) { /** @type {string | undefined} */ let t, /** @type {LILY.Commands | LILY.CommandCB} */ cmd = this.cli
while (t = tokens.shift()) if (U.with(cmd[t], next => !next || this.is_cb(cmd = next))) break // eslint-disable-line no-cond-assign
// either t is undefined, or cmd[t] is undefined or cmd is a function
if (!this.is_cb(cmd)) return t ? `unknown token ${t}` : `subcommands: [${Object.keys(cmd).join(', ')}]`
return U.with(cmd(...tokens), r => typeof r === 'boolean' ? (r ? 'success' : 'fail') : String(r))
},
@ -78,5 +77,5 @@
}
SDK.hookFunction('SpeechTransformGagGarble', 0, ([text]) => text) // disable garbling
SDK.hookFunction('ChatRoomSendChatMessage', 0, (na, n) => Box.enabled ? n(na) : Boolean(W.ChatRoomSendLocal('<span style="color: red">You try to talk, but nothing comes out.</span>')))
W.ChatRoomRegisterMessageHandler({Priority: -169, Description: 'LILY', Callback: data => data.Type === 'Whisper' && data.Content.startsWith('!LILY') && (Belt.receive(data) || true)})
W.ChatRoomRegisterMessageHandler({Priority: -169, Description: 'LILY', Callback: data => data.Type === 'Whisper' && data.Content.startsWith('#LILY') && (Belt.receive(data) || true)})
})()