- 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.
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.
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
- this library is not yet used. it is needed to render lottie stickers, but I am currently having issues installing the python bindings on windows.
- This project uses
poetry
, runpoetry install
to install the required dependencies.- install poetry with
pip install poetry
aubio
andPyAutoTune
are built from source on installation.- on Windows this will require the MSVC compiler
- on Linux this will require
gcc
- install poetry with
- create a copy of
config.example.py
and name itconfig.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.
- 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
- once you've set up all of the libraries, just run the program with
python main.py
(orpython3.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 withpipenv shell
and then runpython main.py
- if using pipenv, run
- terminate the bot by running the
shutdown
command, this will probably close better than a termination
- install heroku cli and log in
- clone mediaforge onto your computer (
git clone https://github.com/HexCodeFFF/mediaforge
)- this will create a folder in the current directory
- run
heroku create
in the newly created mediaforge directory to create a heroku app - 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
- add Heroku Postgres addon
- set up bot config
- create a local config file
- don't worry about
chrome_driver_linux
, this option is ignored in heroku production.
- don't worry about
- encode the file as base64
- on linux:
base64 config.py
prints the output to terminalbase64 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)
- on linux:
- 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
inPRIVATEFILE_config.py
with the filename.
- note: if you want other private files deployed to heroku, do the same steps but replace
- create a local config file
- 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.