Simone
Simone
DIAdiscord.js - Imagine an app
Created by Simone on 8/27/2023 in #djs-questions
Twitter streaming
Hi, I am trying to add a command to my bot to monitor some twitter/X accounts. The operation is very simple, when a user I monitor posts a tweet the bot should send a message in a text channel where it puts the link to the tweet. I have tried searching online but continuously get this error:
API error: TwitterError: Client Forbidden: When authenticating requests to the Twitter API v2 endpoints, you must use keys and tokens from a Twitter developer App that is attached to a Project. You can create a project via the developer portal.
at module.exports.fromJson (C:\Users\arago\Downloads\play-netbot-main (1)\play-netbot-main\node_modules\twitter-v2\build\TwitterError.js:26:16)
at Twitter.get (C:\Users\arago\Downloads\play-netbot-main (1)\play-netbot-main\node_modules\twitter-v2\build\twitter.js:43:49)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Object.execute (C:\Users\arago\Downloads\play-netbot-main (1)\play-netbot-main\Events\client\monitor\twitter.js:20:25) {
details: 'https://api.twitter.com/2/problems/client-forbidden'
}
API error: TwitterError: Client Forbidden: When authenticating requests to the Twitter API v2 endpoints, you must use keys and tokens from a Twitter developer App that is attached to a Project. You can create a project via the developer portal.
at module.exports.fromJson (C:\Users\arago\Downloads\play-netbot-main (1)\play-netbot-main\node_modules\twitter-v2\build\TwitterError.js:26:16)
at Twitter.get (C:\Users\arago\Downloads\play-netbot-main (1)\play-netbot-main\node_modules\twitter-v2\build\twitter.js:43:49)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Object.execute (C:\Users\arago\Downloads\play-netbot-main (1)\play-netbot-main\Events\client\monitor\twitter.js:20:25) {
details: 'https://api.twitter.com/2/problems/client-forbidden'
}
This is my code: https://pastebin.com/XA3rqfuR Thank you
7 replies