Go to file
2022-12-07 13:56:22 -05:00
cache Adding Basic Functions, Generate 2022-12-07 13:56:22 -05:00
.gitignore first commit 2022-12-07 19:17:31 +02:00
index.mjs Adding Basic Functions, Generate 2022-12-07 13:56:22 -05:00
orders_generated.log Adding Basic Functions, Generate 2022-12-07 13:56:22 -05:00
package-lock.json Adding Basic Functions, Generate 2022-12-07 13:56:22 -05:00
package.json Adding Basic Functions, Generate 2022-12-07 13:56:22 -05:00
Procfile first commit 2022-12-07 19:17:31 +02:00
README.md first commit 2022-12-07 19:17:31 +02:00
show.js Adding Basic Functions, Generate 2022-12-07 13:56:22 -05:00

Sarcastic Twitter Bot

This bot reluctantly answer with sarcastic responses. Uses OpenAI's GPT-3 API to generate the comments. Hosted on Heroku, and uses offcial Twitter SDK to interact with Twitter.

Note: Right now, the bot is not deployed because Heroku removed its free tier and I can't find any other alternative that supports running a bot in the background. If you find one, connect me on Twitter roh1tkumar

Note: mention @bot_witty in a tweet or under a tweet like below example.


Getting Stated

Clone the repository

$ git clone https://github.com/rohit1kumar/sarcastic-bot.git

Install dependencies

$ cd sarcastic-bot
$ npm install

Add environment variables

  • Visit OpenAI and get your API key

  • Visit Twitter and get get your API keys and tokens.

  • Create a .env file in the root directory

    $ cp .env.example .env
    $ nano .env
    
  • Now fill the corresponding values in the .env file

    TWITTER_BEARER_TOKEN=
    TWITTER_API_KEY=
    TWITTER_API_SECRET_KEY=
    TWITTER_ACCESS_TOKEN=
    TWITTER_ACCESS_TOKEN_SECRET=
    OPENAI_API_KEY=
    BOT_USERNAME=
    

    Note: Use the same bot username whose API key and token are being used.

Run the bot

$ npm start

I have used another library to post the tweet because the official Twitter SDK was not working for me, got some error which I was not able to resolve, hence I used twit. If you are able to resolve the issue, please feel free to open a PR.