Giter VIP home page Giter VIP logo

chatgpt-twitter-bot's Introduction

Note This project is not affiliated with OpenAI in any way. It is just a fun, open source side project that uses their API.

Example Twitter thread using @ChatGPTBot

ChatGPT Twitter Bot

Twitter bot powered by OpenAI's ChatGPT API.

Build Status MIT License Prettier Code Formatting

Intro

@ChatGPTBot is a Twitter bot that you can @mention with a prompt, and it will respond with a twitter thread containing the ChatGPT response.

It uses the chatgpt Node.js package under the hood.

Usage

Just create a tweet @mentioning @ChatGPTBot containing your prompt:

@ChatGPTBot What is 1 + 1?

Then wait until the bot responds, which can be anywhere from a few seconds to a few minutes (hopefully not longer), depending on how much usage the bot receives.

The ChatGPT response will be split up into multiple tweet-sized replies.

Note

Don't be surprised if it takes awhile for the bot to respond to you. This is due to:

  1. Twitter heavily rate-limits bots.
  2. This bot is just running on my local dev machine, so please be kind ๐Ÿ™

Warning Any improper use of ChatGPTBot will result in an immediate block on Twitter. Improper use covers everything OpenAI's API would consider disallowed / harmful / banned.

Related

License

MIT ยฉ Travis Fischer

Note This project is not affiliated with OpenAI in any way. It is just a fun, open source side project that uses their API.

If you found this project interesting, please consider sponsoring me or following me on twitter twitter

chatgpt-twitter-bot's People

Contributors

transitive-bullshit avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

chatgpt-twitter-bot's Issues

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

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:

  • Cloned the repository with git clone
  • Changed directory with cd chatgpt-twitter-bot
  • Used npm install to install package.json dependencies
  • After installing the dependencies I used the command npm run build to compile
  • After compiling I used the command node build/index.js

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/module_job: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

Need assistance understanding api pool

Hello, I'm going through the code and i am trying to understand how to create a pool of chatgpt accounts, can you please provide some assistance? Thanks

Bot not reading/sending links ?

Hi,

First, very nice job on this Twitter Bot!

I'd like to report a bug (if not done by purpose): When you are including a link in your tweet, it doesn't "consider" it and removes it.

Here is an example:

FmQ96RFX0Ac2344

It's supposed to show "What is xat.com?", and not "What is ?"

Thanks for your reply.

Error: Cannot find module 'node:path'

Whenever i try to run the project using npm run dev or npm run build i keep getting this error

$ npm run build

> [email protected] prebuild
> run-s clean


> [email protected] clean
> del build

Could Not Find C:\Users\bright\Documents\Project\gtp-test\chatgpt-twitter-bot-main\build

> [email protected] build
> tsup

Error: Cannot find module 'node:path'
Require stack:
- C:\Users\bright\Documents\Project\gtp-test\chatgpt-twitter-bot-main\node_modules\rollup\dist\shared\rollup.js
- C:\Users\bright\Documents\Project\gtp-test\chatgpt-twitter-bot-main\node_modules\rollup\dist\rollup.js
- C:\Users\bright\Documents\Project\gtp-test\chatgpt-twitter-bot-main\node_modules\tsup\dist\index.js
- C:\Users\bright\Documents\Project\gtp-test\chatgpt-twitter-bot-main\node_modules\tsup\dist\chunk-PDM6VDW3.js
- C:\Users\bright\Documents\Project\gtp-test\chatgpt-twitter-bot-main\node_modules\tsup\dist\cli-default.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
    at Function.Module._load (internal/modules/cjs/loader.js:725:27)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (C:\Users\bright\Documents\Project\gtp-test\chatgpt-twitter-bot-main\node_modules\rollup\dist\shared\rollup.js:12:19)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Module.require (internal/modules/cjs/loader.js:952:19)

I already ran npm install to set everything but it's not working. Please how can i fix this issue

Unable to get the bot to work with changed config.ts settings

I am trying to deploy the bot via replit. They don't allow .env files so I replaced the secrets look up with os.env and updated a the settings and despire my API keys all looking correct (I get no error messages on the console). Is there anything else in the app I will need to change for this to work?

import path from 'node:path'
import os from 'node:os'

import Conf from 'conf'
import dotenv from 'dotenv-safe'

import * as types from './types'

dotenv.config()

export const twitterBotHandle = '@LatinaLinguaBOT'
export const twitterBotHandleL = twitterBotHandle.toLowerCase()
export const twitterBotUserId = '1667706052433829889'

export const cacheDir = 'out'
export const getTwitterUserMentionsCachePathForUserById = ({
  userId
}: {
  userId: string
}) => path.join(cacheDir, `twitter-mentions-${userId}.json`)

export const defaultMaxNumMentionsToProcessPerBatch = 10

// tweets that try to break the bot...
export const tweetIgnoreList = new Set([
  '1599344387401863174',
  '1604326985416613888',
  '1643945307095420930',
  '1645615915088896000'
])

// ignore known bots; we don't want them endlessly replying to each other
export const twitterUsersIgnoreList = new Set([
  '1506967793409065000', // ReplyGPT
  '1598922281434103808', // source github bot
  '1607692579243687936' // ChatSonicAI
])

// Used by the author(s) for faster testing and feedback
export const priorityUsersList = new Set([
  '327034465' // llm_bot

])

// Optional redis instance for persisting responses
export const enableRedis = false
export const redisHost = process.env.REDIS_HOST || 'localhost'
export const redisPassword = process.env.REDIS_PASSWORD || ''
export const redisUser = process.env.REDIS_USER || 'default'
export const redisNamespace = process.env.REDIS_NAMESPACE || 'chatgpt'
export const redisNamespaceDMs =
  process.env.REDIS_NAMESPACE_DMS || 'chatgpt-dms'
export const redisNamespaceMessages =
  process.env.REDIS_NAMESPACE_MESSAGES || 'chatgpt-messages'
export const redisUrl =
  process.env.REDIS_URL || `redis://${redisUser}:${redisPassword}@${redisHost}`

export default new Conf<types.Config>({
  defaults: {
    refreshToken: os.env.TWITTER_OAUTH_REFRESH_TOKEN,
    accessToken: os.env.TWITTER_OAUTH_ACCESS_TOKEN
  }
})

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.