Git Product home page Git Product logo

tweetor's Introduction

Tweetor

Basic Twitterbot Manager to create automated Tweets. Uses OpenAI's GPT-3 to randomize messages. Hosted on Akash Decentralized Cloud. This example is tested on Ubuntu.

Example

MetaBrainz active Twitterbot is based on this example! See Tweet

NOTE

Do not share your public domain (Akash uri) when using this example template! This is a basic example that is coded hastily in one go and meant for experimental purposes only. The Author and Owner of this repository can not be held liable for any loss resulting from using this code. It is rumored that using GPT-3 for twitter goes against OpenAI's TOS. Use at your own risk.

Requirements

Minimum:

Only needed when hosting on Akash:

Preparation

  1. Setup/Configure Developer accounts
  2. Get the required keys for the environment variables:
  • TWITTER_API_KEY
  • TWITTER_API_SECRET
  • TWITTER_BEARER_TOKEN
  • GPT_ORG_ID
  • GPT_API_KEY
  1. Set callback urls in Twitters Developer Portal:
  • For Local: http://127.0.0.1:5500/authenticate
  • For Akash: See section Test On Akash

Test Locally

Make sure to replace the above mentioned environment variables in .localtest file.

CLI

sudo make build
sudo make up

Once running

  1. Go to: http://127.0.0.1:5500/
  2. Insert callback url http://127.0.0.1:5500/authenticate/
  3. Authorize using Twitter
  4. Call some endpoints (using curl, postman, etc)

Test On Akash

Get started with Akash Docs

Build & Push Docker Image

Edit the Makefile and replace: <dckr_username>/<image-tag:version>

CLI

sudo make push

Create deployment

Once the image has been pushed to dockerhub:

  1. Edit the deploy.yml file.
  2. Create a new deployment with Akashlytics.
  3. Select 'empty' and paste deploy.yml contents.

deploy.yml

Make sure to replace the above mentioned environment variables in deploy.yml file. Additionally replace the image value.

Once deployed:

  1. Go to Akash uri, for example: http://your-akash-uri.eu-west01-akash.provider.com
  2. Insert callback uri, for example: http://your-akash-uri.eu-west01-akash.provider.com/authenticate/
  3. Authorize using Twitter
  4. Call some endpoints (using curl, postman, etc)
  5. NOTE: Do not share your public domain (Akash uri) when using this example template!

Endpoints

  • /create_tweetor
  • /list_tweetors
  • /remove_tweetor
  • /remove_all

[POST] /create_tweetor

http://127.0.0.1:5500/create_tweetor
{
    "interval": {
        "days":0,"hours":0, "minutes": 5, "seconds":0,
        "start_date":"", "end_date":"","timezone":""
    },
    "gpt_use": 1,
    "gpt_prompt": "Tweet something awesome about Elon Musk",
    "gpt_prompt_topic": "@elonmusk",
    "tweetor_type": 0,    
    "tweetor_name": "mytweetor",
    "tweetor_message": ""
}

[GET] /list_tweetors

http://127.0.0.1:5500/list_tweetors

[GET] /remove_tweetor/tweetor_name

http://127.0.0.1:5500/remove_tweetor/mytweetor

[GET] /remove_all

http://127.0.0.1:5500/remove_all

DISCLAIMER

Do not share your public domain (Akash uri) when using this example template! This is a basic example that is coded hastily in one go and meant for experimental purposes only. The Author and Owner of this repository can not be held liable for any loss resulting from using this code. It is rumored that using GPT-3 for twitter goes against OpenAI's TOS. Use at your own risk.

tweetor's People

Contributors

unameit10000000 avatar

Stargazers

 avatar  avatar

Watchers

 avatar

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.