add vanish chat support #10

Closed
opened 2024-04-10 10:19:53 -04:00 by Parker2991 · 2 comments
Owner
No description provided.
Author
Owner
function playerlist (bot) {
  bot.players = []
//chayapak you mentally ok?
  bot.on('packet.player_info', packet => {
    const actions = []

    if (packet.action & 0b000001) actions.push(addPlayer)
    if (packet.action & 0b000010) actions.push(initializeChat)
    if (packet.action & 0b000100) actions.push(updateGamemode)
    if (packet.action & 0b001000) actions.push(updateListed)
    if (packet.action & 0b010000) actions.push(updateLatency)
    if (packet.action & 0b100000) actions.push(updateDisplayName)

    for (const entry of packet.data) {
      for (const action of actions) {
        action(entry)
      }
    }
  })

  bot.on('packet.player_remove', ({ players }) => {
    for (const player of players) {
      bot.players = bot.players.filter(entry => entry.uuid !== player)
    
    }
  })


  function addPlayer (entry) {
    bot.players = bot.players.filter(_entry => _entry.uuid !== entry.uuid)
    bot.players.push({
      uuid: entry.uuid,
      profile: { name: entry.player.name, properties: entry.player.properties },

      chatSession: undefined,
      gamemode: undefined,
      listed: undefined,
      latency: undefined,
      displayName: undefined
    })
  }

  function initializeChat (entry) {
    // TODO: Handle chat sessions
  }

  function updateGamemode (entry) {
    const target = bot.players.find(_entry => _entry.uuid === entry.uuid)
    if (!target) return

    target.gamemode = entry.gamemode
  }

  function updateListed (entry) {
    const target = bot.players.find(_entry => _entry.uuid === entry.uuid)
    if (!target) return

    target.listed = entry.listed
  }

  function updateLatency (entry) {
    const target = bot.players.find(_entry => _entry.uuid === entry.uuid)
    if (!target) return

    target.latency = entry.latency
  }

  function updateDisplayName (entry) {
    const target = bot.players.find(_entry => _entry.uuid === entry.uuid)
    if (!target) return

    try {
      target.displayName = JSON.parse(entry.displayName)
    } catch {
      // do nothing
    }
  }

  bot.on('end', () => (bot.players = []))
}

module.exports = playerlist
```js function playerlist (bot) { bot.players = [] //chayapak you mentally ok? bot.on('packet.player_info', packet => { const actions = [] if (packet.action & 0b000001) actions.push(addPlayer) if (packet.action & 0b000010) actions.push(initializeChat) if (packet.action & 0b000100) actions.push(updateGamemode) if (packet.action & 0b001000) actions.push(updateListed) if (packet.action & 0b010000) actions.push(updateLatency) if (packet.action & 0b100000) actions.push(updateDisplayName) for (const entry of packet.data) { for (const action of actions) { action(entry) } } }) bot.on('packet.player_remove', ({ players }) => { for (const player of players) { bot.players = bot.players.filter(entry => entry.uuid !== player) } }) function addPlayer (entry) { bot.players = bot.players.filter(_entry => _entry.uuid !== entry.uuid) bot.players.push({ uuid: entry.uuid, profile: { name: entry.player.name, properties: entry.player.properties }, chatSession: undefined, gamemode: undefined, listed: undefined, latency: undefined, displayName: undefined }) } function initializeChat (entry) { // TODO: Handle chat sessions } function updateGamemode (entry) { const target = bot.players.find(_entry => _entry.uuid === entry.uuid) if (!target) return target.gamemode = entry.gamemode } function updateListed (entry) { const target = bot.players.find(_entry => _entry.uuid === entry.uuid) if (!target) return target.listed = entry.listed } function updateLatency (entry) { const target = bot.players.find(_entry => _entry.uuid === entry.uuid) if (!target) return target.latency = entry.latency } function updateDisplayName (entry) { const target = bot.players.find(_entry => _entry.uuid === entry.uuid) if (!target) return try { target.displayName = JSON.parse(entry.displayName) } catch { // do nothing } } bot.on('end', () => (bot.players = [])) } module.exports = playerlist
Author
Owner
bot._client.write('packet.tab_complete' , packet => {

})

or smth

```js bot._client.write('packet.tab_complete' , packet => { }) ``` or smth
Parker2991 added the
Feature
label 2024-04-29 10:01:03 -04:00
Parker2991 added the
Status
Abandoned
label 2024-08-17 02:52:57 -04:00
Parker2991 removed the
Status
Abandoned
label 2024-09-25 09:47:05 -04:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Parker2991/FridayNightFunkinBoyfriendBot#10
No description provided.