Yato was planned as a closed-source bot but after +6 months of having it running and +1 year of development I decided it was time to make it open to the community so here we are :)
Don't expect the code to have a good quality, I have learned what I know by myself, and I still have a lot of things to learn so if you want to improve something I appreciate all the pull requests.
Index:
First of all, a list of what you need to have:
- Java 14 or later installed on the machine you're going to run yato
- An app created at discord developer portal
- A MongoDB database (free tier of mongodb atlas it's ok for small bots)
- A Google application with youtube data api V3 enabled
- A spotify application (not in use by the moment but can be implemented in the future)
- Download Lavalink.jar (Lavalink is used to distribute the audio sending load)
- Download the latest yato release or build yato by yourself using the source code.
How to set up yato properly?
- Put your yato-x.x_x.jar in a folder.
- Download the example config files: database_example.json and config_example.json and remove the _example from the names.
- Take a look at the content of the files, there is a few things that you need to configure:
{
"bot-token": "", <- Here you need to put your discord app token
"google-api-key": "", <- The google api key of the google app that you have created
"spotify-client-id": "", <- The spotify client id of the app that you have created
"spotify-secret": "", <- The spotify secret of the spotify app that you have created
"bot-id": "483329776996712468", <- If of your bot user IMPORTANT, If you put a wrong id the audio will not be sent to discord
"bot-game": "https://yato.fernandopal.es", <- Playing...
"bot-shards": 1, <- Number of instances of the bot, I recommend you to put 1 for every ~1500 - 2000 guilds
"bot-prefix": "y:", <- This will be the default prefix for the bot
"bot-owners": [ <- Id's of all the users with FULL CONTROL over the bot commands and features
"214829164253937674"
],
"lavalink-nodes": [ <- Add your lavalink nodes here, must contain at least one
"host:port@password"
],
"dbl-token": "your top.gg token", <- Token obtained if your bot is on top.gg [OPTIONAL, needed just for votes]
"haruna-url": "https://localhost", <- The url where your haruna server is listening [OPTIONAL, needed just for votes]
"haruna-port": "6969", <- The port of that you have set on your haruna config [OPTIONAL, needed just for votes]
"haruna-password": "your-password-here", <- The password of your haruna server [OPTIONAL, needed just for votes]
}
{
"username": "yato", <- Database username
"password": "supersafepassword", <- Database password
"database-url": "yato-5kjsj.gcp.mongodb.net", <- Database connection url
"database-name": "yato", <- Database name
"url-args": "retryWrites=true&w=majority" <- Extra arguments for the database connection
}
{
"port": 7263, <- Port that the bot will use to open the REST API server
"auth-token": "RANDOM_STRING_HERE" <- Put a random string here that will be used for authentication on the api
}
When all of that is done you have everything prepared to run yato, the easiest way to run the bot is to install screen (sudo apt install screen
) if you're running on a unix based system once screen is in your system follow the next steps:
- Open a new screen with
screen -S yato
- Execute the yato-x.x_x.jar file with
java -jar yato-x.x_x.jar
- Detach the screen pressing
Ctrl + A
and thenCtrl + D
- Each time you want to check the yato console you can join the screen using
screen -x yato
and exit of that screen doing the step 3 again
Requisites to compile the java code into a runnable yato.jar:
How do I build the yato.jar file?
- Download or clone this repository
- Join the root folder of the repository, yato-master
- Execute the build.bat script if you're on windows, or the build.sh script if you're on a linux machine (those scripts only contain a single command,
gradlew build
so you can execute this instead if you want) - Now you should have a
/yato-master/build/libs folder
, there you can find the generated yato.jar
- HQ music playback
- Load balancing using Lavalink and the JDA sharding system
- Support for multiple audio sources (YouTube, SoundCloud, Vimeo, Twitch Streams, BandCamp, files on the internet)
- Youtube search
- Customisable prefix for each server
- Song Of The Day (Daily most played song)
- Customisable behaviour for some things
- And more