Git Product home page Git Product logo

mediaforge's Introduction

MediaForge

MediaForge Discord Discord Bots Discord Bots Discord Bots uptime

Total Lines discord.py python stars built with immense swag

ko-fi

A Discord bot for editing and creating videos, images, GIFs, and more!

general technical info about the bot

  • inspired by esmBot
  • uses discord.py (python discord lib)
  • uses FFmpeg for most media functions
  • uses selenium and ChromeDriver to render captions in html with Chrome
    • although not the fastest approach, it is very readable, flexible, and easy to work with/expand.

to self-host

verified working on windows 10/11 and ubuntu 18/20. will probably work on macos and other linux distros if the below libraries are available but theyre untested and unsupported.

external libraries

the bot uses many CLI programs for media processing.

  • FFmpeg - not included but easily installable on windows and linux
    • If installing on ubuntu, ensure that ffmpeg version >= 4
  • gifski - windows executable is included. linux version downloadable from the website
  • pngquant - windows executable is included. installable on linux with sudo apt-get install pngquant
  • ChromeDriver - ChromeDriver is automatically downloaded to match the chrome installation on your system when the bot starts.
    • ChromeDriver requires your installation of chrome to be in one of the default paths for your system. MediaForge also expects this to check if it needs to download a new driver version.
  • ImageMagick - not included but downloadable here
  • ExifTool - windows executable is included. installable on linux with sudo apt-get install exiftool https://exiftool.org/
  • apngasm - windows executable is included. installable on linux with sudo apt-get install apngasm
  • glaxnimate - downloadable on its website

pip libraries

  • This project uses poetry, run poetry install to install the required dependencies.
    • install poetry with pip install poetry
    • aubio and PyAutoTune are built from source on installation.

config

  • create a copy of config.example.py and name it config.py.
  • insert/change the appropriate config settings such as your discord api token. be sure not to add or remove quotes.
  • the 2 required config settings to change for proper functionality are the discord and tenor tokens.

python

  • developed and tested on python 3.8. use that or a later compatible version
  • python 3.10 is NOT compatible (yet) 3.9 should work

to run

  • once you've set up all of the libraries, just run the program with python main.py (or python3.8 main.py or whatever your python is named). make sure it can read and write to the directory it lives in and also access/execute all the aforementioned libraries
    • if using pipenv, run pipenv run python main.py or open the venv shell with pipenv shell and then run python main.py
  • terminate the bot by running the shutdown command, this will probably close better than a termination

!!experimental!! heroku-based hosting

  1. install heroku cli and log in
  2. clone mediaforge onto your computer (git clone https://github.com/HexCodeFFF/mediaforge)
    • this will create a folder in the current directory
  3. run heroku create in the newly created mediaforge directory to create a heroku app
  4. add heroku buildpacks
    heroku buildpacks:add https://github.com/jonathanong/heroku-buildpack-ffmpeg-latest.git
    heroku buildpacks:add https://github.com/heroku/heroku-buildpack-google-chrome.git
    heroku buildpacks:add https://github.com/heroku/heroku-buildpack-chromedriver.git
    heroku buildpacks:add heroku-community/apt
    heroku buildpacks:add heroku/python
  5. add Heroku Postgres addon
  6. set up bot config
    • create a local config file
      • don't worry about chrome_driver_linux, this option is ignored in heroku production.
    • encode the file as base64
      • on linux:
        • base64 config.py prints the output to terminal
        • base64 config.py > config.txt writes the output to config.txt
      • with python:
        import base64
        with open("config.py", "rb") as f:
            out = base64.b64encode(f.read())
        print(out)  # write to terminal
        # write to file
        with open("config.txt", "wb+") as f:
            f.write(out)
    • save file as config option (replace <BASE64OUTPUT> with the output from earlier.)
      heroku config:set PRIVATEFILE_config.py=<BASE64OUTPUT>
      • note: if you want other private files deployed to heroku, do the same steps but replace config.py in PRIVATEFILE_config.py with the filename.
  7. start app
    heroku ps:scale worker=1

NOTE: currently, guild-specific prefixes wont persist after a re-deployment. heroku files are temporary and i haven't YET written the code to interface with their databases.

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.