Skip to content

Commit

Permalink
Merge pull request #633 from ArtBlocks/trivia-tweaking
Browse files Browse the repository at this point in the history
fixing twitter bot error
  • Loading branch information
grantoesterling authored Dec 15, 2023
2 parents c8ad51c + 18b7617 commit d86d9b8
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Classes/TwitterBot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,16 @@ export class TwitterBot {
console.log(
`Search rate limit hit! Limit will reset at timestamp ${error.rateLimit.reset}`
)
} else if (
error?.code === 400 &&
error.errors[0] &&
error.errors[0]?.message &&
error.errors[0]?.message.includes('since_id')
) {
const messageSplit = error.errors[0]?.message.split(' ')
const lastId = messageSplit[messageSplit.length - 1]
console.log('TwitterBot since_id is invalid - setting to', lastId)
this.lastTweetId = lastId
} else {
console.error('Error searching Twitter:', error)
}
Expand Down

0 comments on commit d86d9b8

Please sign in to comment.