twitterbot-nodejs icon indicating copy to clipboard operation
twitterbot-nodejs copied to clipboard

Bot throws an error

Open APratham opened this issue 5 years ago • 3 comments

I am getting an error when I am running the bot, can you please help in debugging it? I haven't shared the tweet, but I can provide some context. It is a tweet that has already been RT

events.js:292
      throw er; // Unhandled 'error' event
      ^

Error: Bad Twitter streaming request: 404
    at Object.exports.makeTwitError (F:\twitterbot-nodejs\node_modules\twit\lib\helpers.js:74:13)
    at Request.<anonymous> (F:\twitterbot-nodejs\node_modules\twit\lib\streaming-api-connection.js:96:29)
    at Request.emit (events.js:327:22)
    at IncomingMessage.<anonymous> (F:\twitterbot-nodejs\node_modules\request\request.js:1076:12)
    at Object.onceWrapper (events.js:421:28)
    at IncomingMessage.emit (events.js:327:22)
    at endReadableNT (_stream_readable.js:1327:12)
    at processTicksAndRejections (internal/process/task_queues.js:80:21)
Emitted 'error' event on StreamingAPIConnection instance at:
    at Request.<anonymous> (F:\twitterbot-nodejs\node_modules\twit\lib\streaming-api-connection.js:99:14)
    at Request.emit (events.js:327:22)
    [... lines matching original stack trace ...]
    at processTicksAndRejections (internal/process/task_queues.js:80:21) {
  code: null,
  allErrors: [],
  twitterReply: '',
  statusCode: 404
}

APratham avatar Dec 01 '20 16:12 APratham

This is an issue with the Twit library

andypiper said:

The User Stream API was retired and removed in 2018, so this unfortunately no longer works.

Read his entire reply here

kathir-t avatar Dec 02 '20 02:12 kathir-t

Is there some way we can fix the error? Or else you know alternative Twitter bots?

APratham avatar Dec 02 '20 02:12 APratham

You can comment out the lines 23 through 29 (the parts using the Stream API). The rest of the code is still functional. I'll send a PR with the working code soon.

kathir-t avatar Dec 03 '20 13:12 kathir-t