transitive-bullshit / chatgpt-twitter-bot

Twitter bot powered by OpenAI's ChatGPT API. It's aliveeeee 🤖
https://twitter.com/ChatGPTBot
MIT License
734 stars 98 forks source link

Can you give me a little help on how to setup this bot? #8

Open RandomUserBTC opened 1 year ago

RandomUserBTC commented 1 year ago

I've been trying to run it since yesterday but I can't succeed 😅 (Trying to guide myself using the AI, I'm still learning to code and for now I only know the basics of Python)

For now I have:

Are these the correct steps? After running node build/index.js it throws the error:

_Error: Dynamic require of "util" is not supported at file:///Users/bruno/chatgpt-twitter-bot/build/index.js:1:382 at file:///Users/bruno/chatgpt-twitter-bot/build/index.js:1:1535 at file:///Users/bruno/chatgpt-twitter-bot/build/index.js:1:462 at file:///Users/bruno/chatgpt-twitter-bot/build/index.js:1:4405 at file:///Users/bruno/chatgpt-twitter-bot/build/index.js:1:462 at file:///Users/bruno/chatgpt-twitter-bot/build/index.js:1:4967 at ModuleJob.run (node:internal/modules/esm/modulejob:194:25) Node.js v19.3.0

I believe I misconfigured the .env file, I'm having trouble understanding how to fill the ChatGPT credentials even though I read the entire NPM package readme

transitive-bullshit commented 1 year ago

Running build isn't necessary; it's more of a test step.

I'm using tsx to execute the script directly.

So npm i -g tsx and tsx src/index.ts

Assuming your .env is setup correctly. Getting all the required .env files is a huge pain unfortunately, especially twitter since we have to use both v1 and v2 of the APIs...

RandomUserBTC commented 1 year ago

Ahh, I get it! I think I'm really missing something in the .env then After running npm i -g tsx and tsx src/index.ts the terminal threw this error now:

_(node:86611) ExperimentalWarning: Custom ESM Loaders is an experimental feature and might change at any time (Use node --trace-warnings ... to show where the warning was created) refreshing twitter access token node:events:491 throw er; // Unhandled 'error' event ^

Error: getaddrinfo ENOTFOUND undefined at node_internal_captureLargerStackTrace (node:internal/errors:491:5) at nodeinternal (node:internal/errors:713:10) at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:107:26) Emitted 'error' event on Keyv instance at: at KeyvRedis. (/Users/bruno/chatgpt-twitter-bot/node_modules/keyv/src/index.js:60:46) at KeyvRedis.emit (node:events:513:28) at KeyvRedis.emit (node:domain:489:12) at EventEmitter. (/Users/bruno/chatgpt-twitter-bot/node_modules/@keyv/redis/src/index.js:18:40) at EventEmitter.emit (node:events:513:28) at EventEmitter.emit (node:domain:489:12) at EventEmitter.silentEmit (/Users/bruno/chatgpt-twitter-bot/node_modules/ioredis/built/Redis.js:460:30) at Socket. (/Users/bruno/chatgpt-twitter-bot/node_modules/ioredis/built/redis/eventhandler.js:189:14) at Object.onceWrapper (node:events:628:26) at Socket.emit (node:events:525:35) { errno: -3008, code: 'ENOTFOUND', syscall: 'getaddrinfo', hostname: 'undefined' } Node.js v19.3.0