/opium-bot

Twitter bot that tweets a random word every 20 minutes.

Primary LanguageJavaScriptMIT LicenseMIT

Contributors Forks Stargazers Issues MIT License LinkedIn


Opium bot

Simple Twitter bot to post "x-word is the opium of the people.", every 20 minutes, where x-word is a random word.
Explore the docs »

Report Bug · Request Feature

Table of Contents

About The Project

Built With

Main libraries and CLI tools used to built the project:

  • Axios: Promise based HTTP client for the browser and node.js;
  • Pluralize: Pluralize or singularize any word based on a count;
  • Random word API: API that returns a collection of random words;
  • Twit: Twitter API Client for node (REST & Streaming API);
  • Wordfilter: A small module meant for use in text generators that lets you filter strings for bad words.

To manage the code style and formatting:

Getting Started

To get a local copy up and running follow these steps.

Prerequisites

Install NodeJS:

Install a package manager:

  • yarn: Yarn 1.x (classic) was used in this project.

or

  • npm
npm install npm@latest -g
  • Obtain Twitter access keys/tokens

To create a bot for Twitter it is necessary to create a Twitter app to obtain the access keys/tokens. Create one account in Twitter (It is necessary to have a verified email associated with the account), then go to https://developer.twitter.com/apps to create the app and get your bot keys/tokens.

Installation

I will assume you are using a Linux distribution.

  1. Clone the repository:

    Using ssh:
    git clone git@github.com:tukno/opium-bot.git
    
    Or using https:
    git clone https://github.com/tukno/opium-bot.git
  2. Install the project dependencies:

    cd opium-bot
    
    yarn

    or using npm:

    cd opium-bot
    
    npm install
  3. Configure environment variables:

    • Run the following command to create your local .env file:
    cp .env.example .env

    the .env file has the following properties that needs to be set (use a text editor of your choice):

     # Twitter tokens
     TWITTER_CONSUMER_KEY=''
     TWITTER_CONSUMER_SECRET_KEY=''
     TWITTER_ACCESS_TOKEN=''
     TWITTER_ACCESS_TOKEN_SECRET=''
    
     INTERVAL_MINUTES=20
  4. Well looks like you are done with configuration and ready to code! (I hope so 🎉), run the following commands to execute the bot locally:

    yarn dev

PS: I deployed this bot at Heroku. For instructions on how to deploy apps to Heroku, check this.

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

Contact

David Oliveira - oliveiradavid.dev@gmail.com

Project Link: https://github.com/tukno/opium-bot

Acknowledgements