Skip to content
This repository has been archived by the owner on Sep 1, 2020. It is now read-only.

Latest commit

 

History

History
220 lines (139 loc) · 15.1 KB

configuration.md

File metadata and controls

220 lines (139 loc) · 15.1 KB

Configuration

Overview

This is an overview of the config.yml files content, when you're self-hosting AvaIre make sure you can find the config.yml file in the root of the project, if you can't find the file you'll need to run the binary jar file

java -jar AvaIre.jar

You can also find a lot of information in the config.yml file, for an example of what a default config.yml file should look like, check the default file on github at github.com/avaire/avaire/blob/master/src/main/resources/config.yml

Properties

Configuration properties.

Environment

The application environment determines what is logged to the console, and what applications are loaded, this is to give a better user experience since having the console flooded with information can be very overwhelming if you don't know what you're looking at.

AvaIre supports two different environments, "production" and "development"

Production is used for minimal console output and for all parts of the application to be enabled. Development is used for debugging messages and preventing some parts of the application from running, to stop in-development changes from ruining the production environment.

Discord Application

Discord application information is things like your application token, application id, application secret, etc. To run a Discord bot you'll need an application token, if you don't already have an application with discord you can easily create one in two minutes.

  1. Start by heading to discordapp.com/developers/applications, once you're there you can create a new application, you can name it whatever you want and give it a fancy picture and description if you want to, once you're done click Create App.
  2. Your application should now have been created, next click on the Create a Bot User button, this will convert the application to a bot user application.
  3. Now that you have a user bot application you can get your bot token under the App Bot User section.

AvaIre needs your Discord application token to login and interact with users, and optionally the application ID for handling music using Lavalink instead of doing it internally, you can also use the application ID to create a invite link for your bot.

Client ID

This is your Discord application client id,if you don't have a Discord application, check the link above and follow the short guide to create one.

Token

This is your Discord application token, if you don't have a Discord application, check the link above and follow the short guide to create one, once you have it, replace the text between the quotes with your token. The bot token is the bot application token, if you don't already have a bot token you can create by following these steps.

{tip} If you want other people to be able to invite the bot you must check the Public Bot options under your App Bot User application settings, if you don't do that you will be the only one that can invite the bot to servers.

OAuth

The oauth field should contain a valid invite link for the bot, the invite link should look like this:

https://discordapp.com/oauth2/authorize?&client_id=<client id>&scope=bot

Just replace the <client id> with your actual bot application id, you can find your bot application id on the discordapp.com/developers/applications page, just click on your application, the client ID is at the very top under the App Details section.

Note: The client id is not your client secret, but your public application client id.

Database

AvaIre uses a database for storing things like custom prefixes, playlists, user XP and levels, statistics, autoroles, aliases and everything else.

AvaIre currently supports MySQL and SQLite database type, to get start simply just populate the fields below with your database login information.

Make sure the database user has permission to create, delete and edit tables in the database you want to use, Ava uses a migration system that will create all the needed tables, and roll out changes between versions automatically, this require creating new tables, and editing and deleting existing tables.

MySQL Setup

    database:
      type: 'mysql'
      database: 'avaire'
      hostname: 'localhost'
      username: 'username'
      password: 'password'

The host should be the host the MySQL database is hosted on, you can add your port to the host by suffixing it with a colon(:) followed by the port you use, for example localhost:3307, if the port is left out the port will use the default 3306 port. If you're running the bot locally and have something like XAMPP or WampServer installed then you should be fine leaving the host as is.

SQLite3 Setup

    database:
        type: 'sqlite'
        filename: 'database.sqlite'

That's about all you need to use the SQLite database in Ava, you don't need to install or setup anything else.

Default Command Prefix

All internal commands registered with Ava will be linked to a command category, each category has a default prefix which are used for all commands linked to that category, setting the default prefix will set the default prefixed used by all the official AvaIre command categories.

Plugins that adds commands and categories to the Ava registry doesn't necessarily have to follow the default prefix set below, check in with the developer for the plugin about the command prefix if one is used, or just change the prefix for the category using the "Change Prefix" command.

Bot Status (Playing)

Once every minute, Ava will change her "playing" status to something on the playing list, you can define what type of status it is by prefixing the status with one of the options below.

  • watching:something
    • This produces "Watching something"
  • listening:some cool music
    • This produces "Listening to some cool music"
  • streaming:video games
    • This produces "Streaming video games"

If no prefix is given the playing status type will be used instead.

Music Lavalink Nodes (Advanced Music Settings)

Lavalink is used internally in Ava to delegate sending and encoding jobs, using Lavalink makes it easy to provided good quality music to everyone around the world at the same time by spreading the needed resources for streaming music out to external encoding nodes.

If a encoding node is closed, disconnects, or stops working for any reason, all music that is streamed through that node will stop and the load-balancer built into Lavalink will begin to distribute the load out to the remaining working nodes, if no working nodes are available the music will not work.

Lavalink is NOT a requirement to use the music features in Ava, it's simply an alternative way to deliver the end result to the user, for more information about Lavalink checkout: https://github.com/Frederikam/Lavalink

Music Activity Settings

Music Activity is a tracking system built into Ava that disconnects the bot from voice channels if no one is listening to music anyway, this can help free up memory and bandwidth that wasn't being used to serve users anyway.

The music activity tracks a few things:

  1. When no one is listening to the music, like when the bot is muted, everyone is deafened, or no one is in the voice channel with the bot.
  2. If the queue is empty, when you request a song by name the queue will be empty until the user selects the song they want to be played, this applies here, if the last song in the queue is playing it will disconnect once the song is done anyway.
  3. If the music is paused, this should be self-explanatory, if you pause the music the bot it will disconnect after awhile unless it is unpaused(resumed).

Audio Encoding and Resampling Quality

Audio encoding and audio resampling is a way to control the quality of audio the bot will deliver for music related commands.

Lower encoding and resampling will use less memory and CPU, but will also produce worse audio quality in the end, while higher encoding and resampling will use more memory and CPU but will in turn produce more clear and "crisp" audio.

Resampling

Audio resampling is tasked with sending the data from the server the bot is hosted on to the Discord servers so people can listen to the music.

Higher resampling rates gives a higher chance that the audio reaches Discord servers so people can hear the audio by sending each frame multiple times, higher resampling uses more CPU since it has to send each frame multiple times.

Encoding

Audio encoding is tasked with encoding the audio track so it is playable by Discord, higher values will produce a higher quality encoded track, which in turn uses more CPU, while lower values will produce a worse quality audio track but ues less CPU to do so.

Bot Access (Bot Administrators)

The bot access property is a string array containing the IDs of users who should have full access to the system commands in the bot, you can find peoples user IDs by using the User ID or User Info commands.

Users who are bot administrators will still need the regular Discord permissions to run all the other commands outside of the System category, so bot admins can't use commands like the ban command without the right Discord permissions.

Sentry.io Error Logging

Sentry.io is an open source error tracking service, it can provide a lot of helpful information to developers on what is going wrong, and where in real-time, Sentry.io uses a DSN url for establishing a link between the bot and their service, the DSN url is used in Ava to log warnings, errors, and exceptions.

To learn more, checkout: https://sentry.io/welcome/

Prometheus Metrics & Spark API

Ava uses Prometheus metrics for tracking a long list of different things within the application during runtime, the metrics are then displayed using Grafana to users on a web-dashboard using graphs.

Along with the metrics, a stats and guilds API is also enabled, displaying stats per-shard, and globally with guild, channel, and user data, as well as the shard ID and the shard status, while the guild API allows getting information about one or more guilds at a time, as well as checking if the bot is on the given server ID or not, this is used by the AvaIre dashboard.

The metrics stats are exposed on ip:port/metrics, the stats API are exposed on ip:port/stats, and the guilds API are exposed on ip:port/guilds/<guild ids> and ip:port:guilds/<guild ids>/exists

For an real-world example of what the metrics looks like when they're setup using Grafana, checkout: https://status.avairebot.com

For setup guides, see:

API Keys

The API Keys properties holds a list of API keys for different services, if the service has a valid API key additional features will be enabled for the bot for the given service.

Note: Any API keys you might use is sensitive and could do a lot of harm if revealed to the public, it is imperative that you don't share these keys with anyone. AvaIre maintainers and staff will NEVER ask for your login details or API keys.

Google

Googles public API offers a lot of really cool features, within Ava the YouTube API is used to retrieve data for music playback and streaming from YouTube, if you don't already have a google API token you can follow these steps.

  1. Go to https://console.developers.google.com/ and create a new project by clicking the dropdown menu in the top-left, you can name it whatever you fancy. Nothing else needs to be changed unless you want to change the project ID or the app engine location. Creating the new application might take a little while so get a cub of coffee while google does their thing.
  2. When the creation process is completed, you'll get taken to the Dashboard screen of the project. In the sidebar on the left, click Library and click on the YouTube Data API option.
  3. When the API page opens, click the Enable button in the top bar, this will enable the YouTube Data API for your project.
  4. Now that the YouTube Data API is enabled we'll have to setup some credentials for the application, click on the Create credentials button in the top right of the page, you'll be geeted with a few options, for the Where will you be calling the API from? field you can select the Web browser (Javascript) option, make sure you check Public data for the What data will you be accessing? option, once you've done that you can create your credentials.
  5. You should now have your API key, you can copy that into the config.json file and use all of YouTubes features.

DialogFlow

DialogFlow is a really cool service that provides you with "AI Agents" that can process text and voice and allows you to setup your own rules for different input, Ava uses a custom agent that allows users to ask Discord related questions and data being used live. If you don't already have a DialogFlow token you can create a simple AI agent in minutes by following these steps.

  1. Head over to DialogFlow and signup using your email or google account, once you're logged in you can create a new AI agent.
  2. When creating the new agent you can either make a public or private agent, if the agent is public other people will be able to use your agent for their own projects.
  3. Setup an AI agent name and description, you can also start adding some sample data and select the language you want the bot to use, once you're done click the Save button in the top right.
  4. Now that your agent is created you can start making some custom intents or enabled prebuilt agents.
  5. Once you're done adding intents you can head over to your agents settings in the top left, there you'll find your Client access token, you can copy that into the config.yml file, the AI feature for Ava will now use your custom agent!

If you want to use the same AI agent Ava uses you can find it on github at: https://github.com/avaire/agent