Skip to content

Commit

Permalink
🤦
Browse files Browse the repository at this point in the history
  • Loading branch information
transitive-bullshit committed Feb 21, 2024
1 parent c7617b1 commit f88544b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
6 changes: 6 additions & 0 deletions bin/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ async function main() {
(process.env.ANSWER_ENGINE as types.AnswerEngineType) ?? 'openai'
validateAnswerEngine(answerEngine)

if (config.twitterApiPlan === 'free') {
throw new Error(
`This bot does not support the "free" twitter API plan. You'll need to upgrade to at least the "basic" plan in order to run this bot.`
)
}

let twitterClient = await getTwitterClient()
const { data: user } = await twitterClient.users.findMyUser()

Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
## Configuring the bot

You'll need a Twitter developer account and a Twitter an app with OAuth 2.0 enabled.
You'll need a Twitter developer account and a Twitter an app with OAuth 2.0 enabled. You must have at least the basic Twitter API plan in order to run this bot; **the free tier is not supported** (it doesn't support fetching tweets which is required for this bot to work).

Set up a `.env` file by copying `.env.example` and initializing all required environment variables.

Expand Down
6 changes: 3 additions & 3 deletions src/twitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ const twitterApiRateLimitsByPlan: Record<

// TODO: according to the twitter docs, this shouldn't be allowed on the
// free plan, but it seems to work...
usersIdMentions: { limit: 180, interval: FIFTEEN_MINUTES_MS },
usersIdMentions: { limit: 1, interval: FIFTEEN_MINUTES_MS },

// TODO: according to the twitter docs, this shouldn't be allowed on the
// free plan, but it seems to work...
findTweetById: { limit: 15, interval: FIFTEEN_MINUTES_MS },
findTweetById: { limit: 1, interval: FIFTEEN_MINUTES_MS },

// TODO: according to the twitter docs, this shouldn't be allowed on the
// free plan, but it seems to work...
findTweetsById: { limit: 15, interval: FIFTEEN_MINUTES_MS }
findTweetsById: { limit: 1, interval: FIFTEEN_MINUTES_MS }
},

basic: {
Expand Down

0 comments on commit f88544b

Please sign in to comment.