Skip to content

Latest commit

 

History

History
309 lines (232 loc) · 11.6 KB

README.md

File metadata and controls

309 lines (232 loc) · 11.6 KB

Contributors Forks Stargazers Issues Codecov MIT License Discord TOP.GG Buy me a coffee


Logo

AI Art

Discord bot generating AI art collages
Explore the docs »

View Demo · Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Deployment
  4. Usage
  5. Contributing
  6. License
  7. Contact
  8. Acknowledgments

About The Project

Product Name Screen Shot

Simple discord bot which generates collages based on any query you give it (most of the time). This bot uses model which you can find here

(back to top)

Built With

(back to top)

Getting Started

Prerequisites

This is an example of how to list things you need to use the software and how to install them.

  • npm
    npm install npm@latest -g

Installation

  1. Create Discord application on a free API Key at https://discord.com/developers/

  2. Click on Bot tab and save your token.

  3. Clone the repo

    git clone https://github.com/karafra/ai-art.git
  4. Install NPM packages

    npm install
  5. Enter your API key and bot id into config.yml.

    sentry:
      dsn: "{SENTRY_DSN}"
    # This one is optional ... only if you want to use ai-story command
    openAi:
      token: ...
    amqp:
      url: "{AMQP_URL}"
    discord:
        token: "{DISCORD_TOKEN}"
    deploy:
      port: "{PORT}"

    Configuration file supports simple environment variable substitution in format "{VARIABLE_NAME}", where parentheses are required.

(back to top)

Deployment

Method 1: Deployment to Heroku

Recommended method of deploying this bot is deployment on Heroku. To deploy to Heroku please click on button bellow.

Deploy

IMPORTANT

After successful deployment you will have to switch dyno from web to worker. If you do not do this, app will not bind to port and fail.

After successful deployment you can invite bot to your server by clicking on this link https://discord.com/api/oauth2/authorize?client_id={CLIENT_ID}&permissions=34816&scope=applications.commands%20bot, where CLIENT_ID is your bots client id. Link already contains minimal scopes (bot, application.commands) and minimal bot permissions (send messages, attach files)

Method 2: Containerized deployment:

Another even easier method of deployment is deployment via docker container.

  1. Verify docker-compose installation

    A] Type docker-compose -v into terminal. if output looks similar to docker-compose version 1.29.2, build 5becea4c then you can continue to the next step.

    B] If this command throws an error, you have to follow docker-compose installation guide

  2. Set required variables

    • Only required variables is TOKEN, this can be set as environment variables using export ENV_NAME=VALUE on linux based OS or $env:VARIABLE_NAME=VALUE on Windows based OS
  3. Building Docker containers

  • Type docker-compose -f "docker/deploy/docker-compose.yml" build into terminal, this will automatically build all required docker images.
  1. Start container
    • Type docker-compose -f "docker/deploy/docker-compose.yml" up into terminal. This will start all services needed. RabbitMQ management console will be accessible here with login credentials being:

      • username:
        • guest
      • password:
        • guest
    • MongoDb management console will be accessible here without any login credentials

This network is not external, so it will not be accessible from outside.

(back to top)

Usage

Commands are separated into 2 command groups

  • help - Help command

  • /ai-art

    • cog-view-2 - Generates collage of 9 images using CogView2 model
    • dalle-mini - Generates collage of 9 images using Dall-e mini model
    • wombo-dream - Generartes one image based on WomboDream model
  • /ai-story

    • story - Generates story from given headline (Requires OpenAi API) token
  • React with ✉️ to any collage and bot will dm it to you.

Discord offers autocompletion so all you need is to start typing name of the command or group in which command is, discord will then guide you through all the required parameters using its autocompletion.

For more examples, please refer to the Documentation

(back to top)

Contributing

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

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  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

(back to top)

License

Distributed under the Apache2.0 License. See LICENSE for more information.

(back to top)

Contact

Your Name - @Karafro - [email protected]

Project Link: https://github.com/karafra/ai-art

(back to top)

Acknowledgments

  • DALL·E Mini
    • Image generation model for /ai-art dalle-mini
  • CogView2
    • Image generation model for /ai-art cog-view-2
  • Open Ai
    • Story generation model for /ai-story story
  • WomboDream
    • Art generation model for ai-art wombo-art

(back to top)