seniv / vk-tg-bot

A Telegram bot that sends messages from vk.com to you in Telegram and vice versa
https://seniv.github.io/vk-tg-bot/
120 stars 20 forks source link

SyntaxError: Unexpected token #4

Closed ghost closed 6 years ago

ghost commented 6 years ago

const { Extra, Markup } = require('telegraf') ^

SyntaxError: Unexpected token { at exports.runInThisContext (vm.js:53:16) at Module._compile (module.js:374:25) at Object.Module._extensions..js (module.js:417:10) at Module.load (module.js:344:32) at Function.Module._load (module.js:301:12) at Function.Module.runMain (module.js:442:10) at startup (node.js:136:18) at node.js:966:3

ghost commented 6 years ago

не обновлялось nodejs, обновил по ману отсюда https://tecadmin.net/install-latest-nodejs-npm-on-ubuntu/# , заработало. При попытке загрузке списка друзей пишет ошибку TypeError: Cannot read property 'time' of undefined

seniv commented 6 years ago

@psh55

При попытке загрузке списка друзей пишет ошибку TypeError: Cannot read property 'time' of undefined

Это скорее всего из-за неправильного ответа от вк, хотя это немного странно. Можешь скинуть всю ошибку?

ghost commented 6 years ago

Это скорее всего из-за неправильного ответа от вк, хотя это немного странно. Можешь скинуть всю ошибку?

TypeError: Cannot read property 'time' of undefined at vk.api.friends.get.then (/home/psh/vk-tg-bot/tkbot.js:57:45) at tryCatcher (/home/psh/vk-tg-bot/node_modules/bluebird/js/release/util.js:16:23) at Promise._settlePromiseFromHandler (/home/psh/vk-tg-bot/node_modules/bluebird/js/release/promise.js:512:31) at Promise._settlePromise (/home/psh/vk-tg-bot/node_modules/bluebird/js/release/promise.js:569:18) at Promise._settlePromise0 (/home/psh/vk-tg-bot/node_modules/bluebird/js/release/promise.js:614:10) at Promise._settlePromises (/home/psh/vk-tg-bot/node_modules/bluebird/js/release/promise.js:693:18) at Async._drainQueue (/home/psh/vk-tg-bot/node_modules/bluebird/js/release/async.js:133:16) at Async._drainQueues (/home/psh/vk-tg-bot/node_modules/bluebird/js/release/async.js:143:10) at Immediate.Async.drainQueues [as _onImmediate] (/home/psh/vk-tg-bot/node_modules/bluebird/js/release/async.js:17:14) at runCallback (timers.js:763:18) at tryOnImmediate (timers.js:734:5) at processImmediate (timers.js:716:5)

seniv commented 6 years ago

Окей, вставь это console.log(JSON.stringify(friends, null, 2)) После }).then((friends) => { (53 строка если не изменял ничего) и покажи что вывело в консоль

ghost commented 6 years ago

{ "count": 1135, "items": [ { "id": 12345, "first_name": "Барак", "last_name": "Обама", "online": 0, "last_seen": { "time": 1521017452, "platform": 1 } } ] } TypeError: Cannot read property 'time' of undefined at vk.api.friends.get.then (/home/psh/vk-tg-bot/tkbot.js:58:45) at tryCatcher (/home/psh/vk-tg-bot/node_modules/bluebird/js/release/util.js:16:23) at Promise._settlePromiseFromHandler (/home/psh/vk-tg-bot/node_modules/bluebird/js/release/promise.js:512:31) at Promise._settlePromise (/home/psh/vk-tg-bot/node_modules/bluebird/js/release/promise.js:569:18) at Promise._settlePromise0 (/home/psh/vk-tg-bot/node_modules/bluebird/js/release/promise.js:614:10) at Promise._settlePromises (/home/psh/vk-tg-bot/node_modules/bluebird/js/release/promise.js:693:18) at Async._drainQueue (/home/psh/vk-tg-bot/node_modules/bluebird/js/release/async.js:133:16) at Async._drainQueues (/home/psh/vk-tg-bot/node_modules/bluebird/js/release/async.js:143:10) at Immediate.Async.drainQueues [as _onImmediate] (/home/psh/vk-tg-bot/node_modules/bluebird/js/release/async.js:17:14) at runCallback (timers.js:763:18) at tryOnImmediate (timers.js:734:5) at processImmediate (timers.js:716:5)

seniv commented 6 years ago

@psh55 напиши мне в телеграм, так будет быстрее

seniv commented 6 years ago

Исправлено в коммите https://github.com/seniv/vk-tg-bot/commit/73b3321f12258b3a1d32c71d75458d9010fa881a