Try to search your question here, if you can't find : Ask Any Question Now ?

Having problem with path (nodejs botbuilder)

HomeCategory: stackoverflowHaving problem with path (nodejs botbuilder)
Avatargaurav asked 5 months ago

im working on a bot using its framework, env framework and json file.
the problem is i cant seem to get the icon showed up unless i set the path manually shown below

var invite = new Welcome(process.env.IconUrl = "C:/Users/2203609/Desktop/Mybot/bot.jpg");

That is not a practical way as we will need to change the path manually every time we transfer over to another computer. So i came up with this idea. i will show my .js, .env and .json

I create 3 variables namely

.js:

const loc = '\bot.jpg';
const pathname = __dirname;
const assa = pathname + loc;

class welcome(){
    constructor(IconUrl, botVersion) {
    this.IconUrl = IconUrl
    this.BotVersion = botVersion
}

}
async Menu(turnContext) {
    var invite = new Welcome(process.env.IconUrl = assa);
    await turnContext.sendActivity({
        attachments: [invite.welcome()]
    });
}

.env:

IconUrl =

"items": [{
     "type": "Image",
     "style": "Person",
     "url": "%IconUrl%",
     "size": "Large"
  }],

the output for this is

[onTurnError]: SyntaxError: Unexpected token U in JSON at position 633

1 Answers
Best Answer
Avatarnaveen answered 5 months ago
Your Answer

3 + 16 =

Popular Tags

WP Facebook Auto Publish Powered By : XYZScripts.com