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("/");
上面是我的代码,请使用Telegram-Bot-api。问题是" split ",当代码运行时,存在错误:" typeError:无法读取未定义的>的属性'split'。如何在模块中使用拆分?
谢谢
听起来像变量str不确定,或者值 word[1]
不确定。拆分在节点环境中正常工作。我会使用api.on
回调中的一些台。即console.log('str>>>', str)
console.log('word>>>', word[1])