Tuesday, 2 May 2017

using split in a module node.js

var telegram = require('telegram-bot-api');
var api = new telegram({
token: '',
updates: {
    enabled: true,
    get_interval: 1000
}
});

api.on('message', function(message){
var chat_id = message.chat.id;

var str = message.text;
var word = str.split(" ");
var yr = word[1].split("/");

above is my code, use the telegram-bot-api. Problem is the "split", when the code run, there is error: "TypeError: Cannot read property 'split' of undefined". How can I use split in a module?

thank you



via FanLee

No comments:

Post a Comment