Skip to content

rohit1kumar/sarcastic-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Sarcastic Bot - A GPT-3 powered Twitter Bot that Replies with a Sarcastic Comments.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published