cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements
Walkthrough Wednesdays
264
Views
0
Helpful
1
Replies
mt8
Beginner
Beginner

undefined bot user

Hi,

 

With the code below in visual studio code I am getting an error:


msg.user = src.user
^

TypeError: Cannot set property 'user' of undefined

 

and console.log(bot.user) displays "undefined".  The bot successfully receives the message but cannot reply. Do you have an  idea why the bot user is undefined?

 

Thank you

const Botkit = require('../lib/JabberBot.js')

var controller = Botkit({
    json_file_store: './bot_store/'
});

var bot = controller.spawn({
    client: {
        jid: 'mybot@me.com',
        password: 'test',
        host: 'test', 
        port: 1111
    }
});

controller.hears(['hi'], ['direct_mention', 'direct_message'], function(bot, message) {
    console.log(bot.user)
    console.log(message.text)
    console.log(message.user)

    bot.reply('my reply');
});

 

 

1 REPLY 1
Jaime Valencia
Hall of Fame Cisco Employee

Probably want to post this over at DevNet

HTH

java

if this helps, please rate
Content for Community-Ad

Spotlight Awards 2021