JavaScriptの文にて、遅延実行をさせたいのですがエラーが発生します。
UTF
1if(txt == 'help jp' && isAdminOrBot(seq.from_)) { 2 seq.text = this.jphelp; 3 this._client.sendMessage(0, seq); 4 }
上記を下記のようにしました。
UTF
1if(txt == 'help jp' && isAdminOrBot(seq.from_)) { 2 setTimeout( function() { 3 seq.text = this.jphelp; 4 this._client.sendMessage(0, seq); 5 }, 1500 ); 6 }
実行すると下記のようなエラーが発生します。
UTF
1TypeError: Cannot read property 'sendMessage' of undefined 2 at Timeout._onTimeout (/root/LineAlphatFork/src/main.js:1380:21) 3 at ontimeout (timers.js:458:11) 4 at tryOnTimeout (timers.js:296:5) 5 at Timer.listOnTimeout (timers.js:259:5)
解決方法のご存知の方、修正お願いします。
回答4件
あなたの回答
tips
プレビュー