mirror of
https://code.chipmunk.land/Parker2991/NitoriBot/
synced 2026-12-04 08:05:40 -05:00
more overhauls
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
class command_spy {
|
||||
constructor (context) {
|
||||
const bot = context.bot
|
||||
|
||||
bot.on('system_chat', (message) => {
|
||||
try {
|
||||
const child = message.extra
|
||||
const sender = bot.players.find((e) => e?.profile?.name === message.text)?.profile?.name === message.text
|
||||
if (!child || !message.text || !message.color || !sender) return
|
||||
const command = child[1].text.substring('/'.length)
|
||||
|
||||
if (
|
||||
(
|
||||
message.color === 'yellow'
|
||||
&&
|
||||
child[0].text === ': '
|
||||
&&
|
||||
child[1].text === `/${command}`
|
||||
&&
|
||||
sender
|
||||
)
|
||||
||
|
||||
(
|
||||
message.color === 'aqua'
|
||||
&&
|
||||
child[0].text === ': '
|
||||
&&
|
||||
child[1].text === `/${command}`
|
||||
&&
|
||||
sender
|
||||
)
|
||||
) bot.emit('parsed_message', {
|
||||
sender: bot.players.find((e) => e.profile.name === message.text),
|
||||
contents: { text: command },
|
||||
type: "minecraft:chat",
|
||||
chatType: "command_spy",
|
||||
displayName: bot.players.find((e) => e.profile.name === message.text).displayName
|
||||
})
|
||||
} catch (e) {
|
||||
console.log(e.stack)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = command_spy;
|
||||
Reference in New Issue
Block a user