Closed Teoreez closed 4 years ago
Full code:
const { Alice, Scene, Reply, Markup } = require('yandex-dialogs-sdk'); const alice = new Alice(); const M = Markup; const welcomeMatcher = ctx => ctx.data.session.new === true; alice.command(welcomeMatcher, ctx => Reply.text('Привет! Я загадала число от 1 до 100. Сможешь отгадать его?', { buttons: [M.button('Давай попробуем!'), M.button('Не хочу')], }), ); alice.command('Давай попробуем!', ctx => { console.log(ctx.message); console.log(ctx.userid); //const uid = String(ctx.userId); //console.log(uid); //const uidalt = ctx.get('userId'); //console.log(uidalt); }); const server = alice.listen(8080, '/');
Terminal log for normal interaction:
PS H:\Apps\Adventure\Adventure Engine\Adventure-Engine---YandexAlice-MongoDB-JS> node test3.js Давай попробуем! undefined
For: ctx.userid (lowercase)
For:
const uidalt = ctx.get('userId'); console.log(uidalt);
And Finaly For:
const uid = String(ctx.userId); console.log(uid);
PS H:\Apps\Adventure\Adventure Engine\Adventure-Engine---YandexAlice-MongoDB-JS> node test3.js 11dff563-fa0c-5017-99d7-cdd70c90119b
Tadam...
no longer reproducable
Full code:
Terminal log for normal interaction:
For: ctx.userid (lowercase)
For:
And Finaly For:
Tadam...