conv.user.storage value not saving across sessions when invoking via speech

余生长醉 提交于 2019-12-13 17:06:02

问题


I am trying to use the conv.user.storage to save information across sessions for my user, namely I want to give him an ID.

When I invoke my action via keyboard, it will save my user storage ID fine, and when I run the action again from my developer console, it will console.log the saved ID in the session. However, when I invoke the action via speech, it will not save the storage value for the next session.

const generateRandomId = require('uuid/v4');
app.intent('Default Welcome Intent',(conv) =>{

  if(conv.user.storage["id"] ==undefined){

    conv.user.storage.id = generateRandomId();
  }

  console.log(conv.user.storage.id);

conv.close(`your user id is ${conv.user.storage.id});
});

so this intent will generate a new value every time for conv.user.storage.id when using the action via speech with my google home device, I want it to be the same every time, this is so I can save my user ID in the database to track their highscore.

EDIT

This is also occurs when I try to track the ID using conv.user.id, so when i use my action with keyboard it will always be the same ID of:

ABwppHGgFSnon5unUNjikof_5G-m_8lldEd_LIokoqYlOsCSFm96--UHDJ_GOHHo6hFOQUZVoMTT6TvfT_edklKbaPm

whereas the id which is produced by conv.user.id when using the app via speech is just a bunch of numbers like this:

1539765602273384238765

来源:https://stackoverflow.com/questions/52853576/conv-user-storage-value-not-saving-across-sessions-when-invoking-via-speech

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!