Gielert / NoodleJS

A NodeJS Mumble client
36 stars 14 forks source link

No parent channel #10

Open wvffle opened 7 years ago

wvffle commented 7 years ago

After testing a basic example I've faced this stack:

/root/mumble-bot/node_modules/noodle.js/src/structures/Channel.js:38
                this.parent.children.set(this.id, this)
                           ^

TypeError: Cannot read property 'children' of undefined
    at Channel.setup (/root/mumble-bot/node_modules/noodle.js/src/structures/Channel.js:38:28)
    at new Channel (/root/mumble-bot/node_modules/noodle.js/src/structures/Channel.js:20:24)
    at ChannelState.handle (/root/mumble-bot/node_modules/noodle.js/src/handlers/ChannelState.js:14:23)
    at Connection.Client.connection.on.data (/root/mumble-bot/node_modules/noodle.js/src/Client.js:90:65)
    at emitOne (events.js:115:13)
    at Connection.emit (events.js:210:7)
    at Connection._processMessage (/root/mumble-bot/node_modules/noodle.js/src/Connection.js:67:14)
    at Connection._processData (/root/mumble-bot/node_modules/noodle.js/src/Connection.js:62:18)
    at Connection._onReceiveData (/root/mumble-bot/node_modules/noodle.js/src/Connection.js:53:18)
    at emitOne (events.js:115:13)
    at TLSSocket.emit (events.js:210:7)
    at addChunk (_stream_readable.js:252:12)

I've logged all the data objects in Channel.setup and the last one is the one that crashed

{ channelId: 9,
  parent: 0,
  name: 'AFKownia',
  description: 'AFKownia (zajebana masterowi)',
  position: -9 }
{ channelId: 6,
  parent: 0,
  name: 'Arturownia (gruba impreza)',
  position: 11 }
{ channelId: 32,
  parent: 0,
  name: 'Krystianownia',
  description: 'I love you all',
  position: 0 }
{ channelId: 39,
  parent: 0,
  name: 'Mikusiownia (awww)',
  position: 9 }
{ channelId: 29,
  parent: 0,
  name: 'Najlepsza Gaming',
  position: -1 }
{ channelId: 7, parent: 0, name: 'Olownia', position: 0 }
{ channelId: 66, parent: 0, name: 'Rurkarnia', position: 10 }
{ channelId: 1, parent: 0, name: 'Juniorownia', position: 0 }
{ channelId: 71, parent: 0, name: 'Pandownia', position: 0 }
{ channelId: 52,
  parent: 6,
  name: '# WITAJ NA NAJGRUBSZYM KANALE EVER',
  position: -510 }
{ channelId: 22, parent: 6, name: '#AFK# Jadalnia', position: 0 }
{ channelId: 51, parent: 6, name: 'GLOSOWY_PL', position: -49 }
{ channelId: 25,
  parent: 6,
  name: 'Jasne głośne miejsce tak duże żeby artur sie zmieścił',
  position: 0 }
{ channelId: 47,
  parent: 6,
  name: 'Jestem kurwa głodny',
  position: 0 }
{ channelId: 49,
  parent: 6,
  name: 'Ol płaci za pizzę xD',
  position: 0 }
{ channelId: 46, parent: 6, name: 'Pizza room', position: 0 }
{ channelId: 48, parent: 6, name: 'Rakowisko', position: 0 }
{ channelId: 23,
  parent: 6,
  name: 'SMUTALNIA',
  description: 'szloch szloch',
  position: 0 }
{ channelId: 50, parent: 6, name: 'UCRAFT_PL', position: -50 }
{ channelId: 54,
  parent: 6,
  name: 'czeka na przeniesienie do wafla',
  position: -509 }
{ channelId: 27,
  parent: 6,
  name: 'kazi ciota w opisie XDDD',
  description: '<a href="https://wvffle.net/screen/20160728210902.png"><span style="color:#0b8eb2">https://wvffle.net/screen/20160728210902.png</span></a>',
  position: 0 }
{ channelId: 35,
  parent: 32,
  name: 'Depresja',
  description: 'Kill me',
  position: 3 }
{ channelId: 65,
  parent: 32,
  name: 'Gierki',
  description: 'Bo czemu nie?',
  position: 0 }
{ channelId: 33,
  parent: 32,
  name: 'Jadalnia ',
  description: 'Jem albo robię jedzenie smacznym. BRB.',
  position: 1 }
{ channelId: 34,
  parent: 32,
  name: 'Kącik filmowy',
  description: 'Jestem zjebany i oglądam filmy na youtubie ._. Jak coś pisać\n<p style="-qt-paragraph-type:empty"><br/></p>',
  position: 1 }
{ channelId: 69, parent: 32, name: 'Prywatka', position: 12341 }
{ channelId: 68,
  parent: 32,
  name: 'Siedzę na tsie ',
  description: ':v',
  position: 0 }
{ channelId: 37,
  parent: 32,
  name: 'Siłownia or prysznic',
  description: 'BRB\n<p style="-qt-paragraph-type:empty"><br/></p>',
  position: 2 }
{ channelId: 57,
  parent: 32,
  name: 'Sprawko Nauka Whatever',
  description: '<b><i><u>Still not playing</u></i></b>',
  position: -20 }
{ channelId: 70,
  parent: 32,
  name: 'Sypialnia',
  description: 'zzz',
  position: 0 }
{ channelId: 72, parent: 32, name: 'Łazienka', position: 0 }
{ channelId: 73, parent: 32, name: 'Sprzątanie', position: 0 }
{ channelId: 15,
  parent: 12,
  name: '#AFK# Piesełownia',
  description: 'very long description',
  position: 3 }

There is no channel with id 12 so there's no parent for channel 15. Also channel 12 is a child of 0

Gielert commented 7 years ago

Like you said. Channel with id 12 doesn't exist (it's not being reported by the server). Could you try to comment out line 37 & 38 in Channel.js and continue to log the data objects. It seems like there maybe some issue where your server is reporting channel 15 before channel 12 has been reported and added to the channels object in the client.