cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
547
Views
0
Helpful
1
Replies

undefined bot user

mt8
Level 1
Level 1

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
Cisco Employee
Cisco Employee

Probably want to post this over at DevNet

HTH

java

if this helps, please rate