!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 = { /** @type {LILY.Belt} */ const Belt = {
admins: [71_240, 67_994], admins: [71_240, 67_994],
cli: {'!LILY': { cli: {'#LILY': {
status: _ => '200 OK', status: _ => '200 OK',
box: { box: {
on: _ => Box.enable(), on: _ => Box.enable(),
@ -67,7 +67,6 @@
/** @type {LILY.Belt['is_cb']} */ is_cb: s => typeof s === 'function', /** @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 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 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(', ')}]` 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)) 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('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>'))) 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)})
})() })()