I make a bot for VK on Node.js. Can not get the ID of the author of the last message of the conference. Returns undefined. Do not understand why

'use strict'; (o) => { let comp = ['Π·Π°Π²ΠΎΡ€ΠΎΠΆΡƒΡŽΡ‡ΠΈΠΉ','сСксі','ΡˆΠΈΠΊΠ°Ρ€Π½ΠΈΠΉ','Ρ‚Π°ΠΊΠΈΠΉ Π·Π²Π°Π±Π»ΠΈΠ²ΠΈΠΉ','красавчик','ΠΊΡ€Π΅Π°Ρ‚ΠΈΠ²Π½ΠΈΠΉ','Ρ€ΠΎΠΌΠ°Π½Ρ‚ΠΈΡ‡Π½ΠΈΠΉ','солодСнький','Π·Π°Π³Π°Π΄ΠΊΠΎΠ²ΠΈΠΉ','Π±Π΅Π·Π΄ΠΎΠ³Π°Π½Π½ΠΈΠΉ','скромняга','ΠΏΡ€ΠΈΠ²Π°Π±Π»ΠΈΠ²ΠΈΠΉ','нСзрівнянний','Ρ„Π΅Ρ”Ρ€ΠΈΡ‡Π½ΠΈΠΉ','самий-самий',]; var lenComp = comp.length - 1; var choise = parseInt((Math.random() * (lenComp - 0 + 1)) + 0); var gans = comp[choise]; o['$'].callMethod('messages.getHistory', {offset: 1, count: 1, peer_id: 2000000112}, (ans) => { try { ans = JSON.parse(ans)['response']['items']; o['bot'].send(`🍏 ${['user_id']}`, o['body'], {}); } catch(e) { o['bot'].send('Команда ΠΏΡ€Π°Ρ†ΡŽΡ” Ρ‚Ρ–Π»ΡŒΠΊΠΈ Π² конфСрСнціях', o['body'], {}); } }); } 

  • so maybe there are no more messages items here and undefined - Alexey Shimansky
  • If I test a query with the same parameters in the VK documentation. All OK. - Vania Kycher

0