这里一切正常,但是当我尝试创建一个数组以添加多个ID时,我会收到错误消息。
follow: ['1046961121792614402', '1000086816572112896']
仅在添加多个ID时返回错误。任何反馈?谢谢
Error Status 401.
at ClientRequest.emit (events.js:182:13)
at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:555:21)
at HTTPParser.parserOnHeadersComplete (_http_common.js:109:17)
at TLSSocket.socketOnData (_http_client.js:441:20)
at TLSSocket.emit (events.js:182:13)
at addChunk (_stream_readable.js:283:12)
at readableAddChunk (_stream_readable.js:264:11)
整个代码:
var Twitter = require('twitter');
var client = new Twitter({
consumer_key: process.env.TWITTER_CONSUMER_KEY,
consumer_secret: process.env.TWITTER_CONSUMER_SECRET,
access_token_key: process.env.TWITTER_ACCESS_TOKEN_KEY,
access_token_secret: process.env.TWITTER_ACCESS_TOKEN_SECRET
});
/**
* Stream statuses filtered by keyword
* number of tweets per second depends on topic popularity
**/
const stream = (bot) => {
client.stream('statuses/filter', { follow: ['104696112179261440', '1231231'] },
function (stream) {
stream.on('data',
function (tweet) {
bot.guilds.get('432635411726346').channels.get('432635264580097').send('Hi');
});
stream.on('error', function (error) {
console.log(error);
});
});
};
module.exports = {
client, stream
};