Note:
- This is a minimal example, with no SSL, rate limit, or CORS configuration on the NGINX server
- Degabut is at its early stage and unstable at the moment, the versioning isn't semantic, which means minor / patch version bump might contains breaking changes, but latest push on Degabut Web should be compatible with
latestDegabut image (suspiciouslookingowl/degabut:latest)
- Clone this repository (or Download it)
git clone https://github.com/degabut/examples
- Copy
.env.exampleto.env
cp .env.example .env
- Modify
.envvalue as needed, here are some descriptions about the environment variables
| Key | Description | Example |
|---|---|---|
BOT_TOKEN |
Your bot token, taken from this page -> Select your app -> go to Bot -> get TOKEN value |
xxx.yyy.zzz |
DISCORD_OAUTH_CLIENT_ID |
Your bot oauth client id, taken from this page -> Select your app -> go to OAuth2 -> get CLIENT ID value |
777777777777777 |
DISCORD_OAUTH_CLIENT_SECRET |
Your bot oauth client secret, taken from this page -> Select your app -> go to OAuth2 -> get CLIENT SECRET value |
jgj04835uefgjxdljb |
LAVA_HOST |
Lavalink host, leave this value to default | degabut-lavalink (default) |
LAVA_PASSWORD |
Long randomly generated password for Lavalink | l0nG-r4nD0M-P45SwOrD |
POSTGRES_DB |
Postgres database name that is created when the image first started, you can leave this value to default | degabut (default) |
POSTGRES_USER |
Postgres default user name, you can leave this value to default | degabut (default) |
POSTGRES_PASSWORD |
Long randomly generated password for your database | l0nG-r4nD0M-P45SwOrD |
POSTGRES_HOST |
Postgres host, leave this value to default | postgres:5432 (default) |
JWT_PRIVATE_KEY |
Very long randomly generated string for API authentication | l0nG-r4nD0M-5tR1nG |
- Copy
LAVA_PASSWORDvalue from your.envfile, and paste it tolavalink/application.yml, underlavalink->server->password, for example:
lavalink:
server:
password: "l0nG-r4nD0M-P45SwOrD"- Run the containers
docker-compose up -d
- Verify that your bot is running properly by, inviting your bot to your server, join a voice channel and send
!play never gonna give you up
While the bot is usable now, you can have a better experience by using the web client
-
Copy
.env.web.exampleto.env.web -
Modify
.env.webvalue as needed, here are some descriptions about the environment variables
| Key | Description | Example |
|---|---|---|
VITE_API_BASE_URL |
URL to your Degabut API | http://yourhost.com/api |
VITE_YOUTUBE_API_BASE_URL |
URL to your Degabut YouTube API | http://yourhost.com/api/youtube |
VITE_WS_URL |
URL to WebSocket API | ws://yourhost.com/ws |
VITE_OAUTH_URL |
Discord OAuth URL for Authentication, more information here | https://discord.com/api/oauth2/authorize?... |
-
Uncomment under the
FOR WEBcomment on thedocker.compose.ymlfile, enablingdgb-nginxanddgb-web-builderservices -
Run the containers again
docker-compose up -d -
Verify that the website is running properly by visiting
http://yourhost.com
To generate OAUth URL:
- Go to https://discord.com/developers/applications
- Select your application
- Select
OAuth2->General - Add redirects URL, if you are following this tutorial, add
http://yourhost.com/oauth - Select
OAuth2->URL Generator - Check
Identifyscope and select the redirect URI with the one you just added, the generated link should look like
https://discord.com/api/oauth2/authorize?client_id=[your_client_id]&redirect_uri=[your_redirect_uri]&response_type=code&scope=identify
If you want to run multiple bots, follow these steps:
- Uncomment under the
FOR MULTI BOTcomment on thedocker.compose.ymlfile (enablingdgb-redservice) - Add the
RED_TOKENvalue on.envfile with your second bot token - If you are using the web client, add the
VITE_APPLICATIONSvalue on.env.web - Run the containers again
docker-compose up -d
VITE_APPLICATIONS value is a minified JSON array string of this object:
{
"name": "Bot Name",
"apiBaseUrl": "bot-api-base-url",
"wsUrl": "bot-ws-url",
"iconUrl": "url-or-path-to-icon"
}If you are following this example, the value should be a minified JSON of:
[
{
"name": "Degabut",
"apiBaseUrl": "http://yourhost.com/api",
"wsUrl": "ws://yourhost.com/ws",
"iconUrl": "/icons/colors/degabut-default.png"
},
{
"name": "Redgabut",
"apiBaseUrl": "http://yourhost.com/red-api",
"wsUrl": "ws://yourhost.com/red-ws",
"iconUrl": "/icons/colors/degabut-red.png"
}
]So the env value should be:
VITE_APPLICATIONS=[{"name":"Degabut","apiBaseUrl":"http://yourhost.com/api","wsUrl":"ws://yourhost.com/ws","iconUrl":"/icons/colors/degabut-default.png"},{"name":"Redgabut","apiBaseUrl":"http://yourhost.com/red-api","wsUrl":"ws://yourhost.com/red-ws","iconUrl":"/icons/colors/degabut-red.png"}]
Note:
Degabut Webprovides 5 icons with different colors that you can use for your bot icons (oniconUrlvalue), if you are following this example, it can be loaded fromhttp://yourhost.com/icons/colors/degabut-[color].png
| Key | Icon |
|---|---|
degabut-default.png |
|
degabut-red.png |
|
degabut-orange.png |
|
degabut-green.png |
|
degabut-blue.png |
Degabut by default only allows YouTube videos / playlists (and can't be disabled). Degabut v5 adds Spotify support, but it is disabled by default, to enable it, simply pass
| Key | Description |
|---|---|
SPOTIFY_CLIENT_ID |
Spotify Client ID |
SPOTIFY_CLIENT_SECRET |
Spotify Client Secret |
to your .env file. Credentials can be obtained from Spotify Developer Dashboard
You can also add VITE_SPOTIFY_INTEGRATION=true to your .env.web file to enable Spotify integration on the web client (allows drag and drop Spotify links to the queue)
Degabut Web Client can be used as an embedded activity on Discord. To enable it:
- Activate activity feature on your Discord application
- Set this as the URL mappings configuration:
| Prefix | Target | Description |
|---|---|---|
/_/gstatic/{subdomain} |
{subdomain}.gstatic.com |
for google font |
/_/ytimg/{subdomain} |
{subdomain}.ytimg.com |
for youtube images |
/_/spotify/{subdomain} |
{subdomain}.spotify.com |
for Spotify API if integration is enabled |
/_/spotifycdn/{subdomain} |
{subdomain}.spotifycdn.com |
for Spotify media if integration is enabled |
/_/scdn/{subdomain} |
{subdomain}.scdn.co |
for spotify media if integration is enabled |
/ws |
ws://yourhost.com/ws |
for websocket connection |
/api |
http://yourhost.com/api |
for API connection |
/ (ROOT MAPPING) |
http://yourhost.com |
root |
-
Pass
VITE_DISCORD_ACTIVITY_APPLICATION_IDto your.env.webfile with the value of your Discord application ID. -
Pass
VITE_DISCORD_ACTIVITY_URL_MAPPINGSto your.env.webfile with the value of the URL mappings configuration in form of minified JSON array string for url patching, for example, your configuration:
[
{
"prefix": "/_/gstatic/{subdomain}",
"target": "{subdomain}.gstatic.com"
},
{
"prefix": "/_/ytimg/{subdomain}",
"target": "{subdomain}.ytimg.com"
},
{
"prefix": "/_/spotify/{subdomain}",
"target": "{subdomain}.spotify.com"
},
{
"prefix": "/_/spotifycdn/{subdomain}",
"target": "{subdomain}.spotifycdn.com"
},
{
"prefix": "/_/scdn/{subdomain}",
"target": "{subdomain}.scdn.co"
},
{
"prefix": "/ws",
"target": "yourhost.com/ws"
},
{
"prefix": "/api",
"target": "yourhost.com/api"
}
]The env value should be:
VITE_DISCORD_ACTIVITY_URL_MAPPINGS=[{"prefix":"/_/gstatic/{subdomain}","target":"{subdomain}.gstatic.com"},{"prefix":"/_/ytimg/{subdomain}","target":"{subdomain}.ytimg.com"},{"prefix":"/_/spotify/{subdomain}","target":"{subdomain}.spotify.com"},{"prefix":"/_/spotifycdn/{subdomain}","target":"{subdomain}.spotifycdn.com"},{"prefix":"/_/scdn/{subdomain}","target":"{subdomain}.scdn.co"},{"prefix":"/ws","target":"yourhost.com/ws"},{"prefix":"/api","target":"yourhost.com/api"}]