Skip to content

Instantly share code, notes, and snippets.

@Khuzha
Created September 12, 2018 16:07
Show Gist options
  • Save Khuzha/2fb5c118dcdcc545f975906381cb2150 to your computer and use it in GitHub Desktop.
Save Khuzha/2fb5c118dcdcc545f975906381cb2150 to your computer and use it in GitHub Desktop.
*Мне нужно узнать, на чье сообщение отвечает юзер
Пишу
console.log(ctx.update.message.reply_to_message.from.id)
для:
{"update_id":271606609,"message":{"message_id":294,"from":{"id":62253745,"is_bot":false,"first_name":"Endorphine","username":"Khuzha","language_code":"ru"},"chat":{"id":62253745,"first_name":"Endorphine","username":"Khuzha","type":"private"},"date":1536767250,"reply_to_message":{"message_id":283,"from":{"id":667423748,"is_bot":true,"first_name":"Khuzha","username":"KhuzhaBot"},"chat":{"id":62253745,"first_name":"Endorphine","username":"Khuzha","type":"private"},"date":1536766748,"forward_from":{"id":346724642,"is_bot":false,"first_name":"Jakhongir","username":"itashpik","language_code":"en-US"},"forward_date":1536766748,"text":"Не работает"},"text":";\\"}}
Выходит ошибка:
TypeError: Cannot read property 'from' of undefined
at bot.on (/home/oneuser/MyProjects/bots/contactbot/index.js:23:51)
at Promise.resolve.then (/home/oneuser/MyProjects/bots/contactbot/node_modules/telegraf/composer.js:107:56)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
Failed to process updates. TypeError: Cannot read property 'from' of undefined
at bot.on (/home/oneuser/MyProjects/bots/contactbot/index.js:23:51)
at Promise.resolve.then (/home/oneuser/MyProjects/bots/contactbot/node_modules/telegraf/composer.js:107:56)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment