Closed j2l closed 2 years ago
My bad, {} is still a promise (but fulfilled)
async function userentry (message) {
const usersdetails = await bot.getUservars()
...
Still not getting the user's name in the result :(
{
"topic": "random",
"__initialmatch__": "(hello|hi|hey|howdy|hola|hai|yo) [*]",
"__history__": {
"input": ["hello bot", "undefined", "undefined", "undefined", "undefined", "undefined", "undefined", "undefined", "undefined", "undefined"],
"reply": ["Hi. What seems to be your problem?", "undefined", "undefined", "undefined", "undefined", "undefined", "undefined", "undefined", "undefined", "undefined"]
},
"__lastmatch__": "(hello|hi|hey|howdy|hola|hai|yo) [*]",
"__last_triggers__": [{
"trigger": "(hello|hi|hey|howdy|hola|hai|yo) [*]",
"reply": ["How do you do. Please state your problem.", "Hi. What seems to be your problem?"],
"condition": [],
"redirect": null,
"previous": null
}]
}
Oh, the following interaction writes it to the uservars. I don't get how it replies using the user's name while not writing it to uservars.
OK, reply is the memory writing process. Must have async func following it.
Hello there, Reading the doc and the JS example, I'm starting to understand the JS API and build a SPA (only browser, no server) bot. But
getUservars()
is always throwing empty object in the browser console:See getUservars() in:
Before the bot reply I want to see Uservars getting populated. And I can't use currentUser() since it's for macro, right?
I don't get why getUservars() returns an empty object while the bot keeps record of the user's name. Not "undefined" or "Promise" but empty.
I'm using local rivescript.min.js from https://unpkg.com/rivescript@2.2.0/dist/rivescript.min.js Node v14.18.2 (only to bundle)
What did I miss? Thanks!