chipmunkbot3/plugins/players.js
2024-02-11 21:23:41 -05:00

15 lines
374 B
JavaScript

function inject (bot, client) {
bot.players ??= {}
client.on('player_info', (packet) => {
if (packet.action === 0) {
packet.data.forEach((player) => {
bot.players[player.name] = player
bot.players[player.UUID] = player
if (player.UUID === bot._client.uuid) { bot.player = player }
})
}
})
}
module.exports.client = inject