diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..644fb82 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,7 @@ +**/node_modules/ +**/dist +.git +npm-debug.log +.coverage +.coverage.* +.aws \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 91af893..f16cf72 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,4 +7,4 @@ RUN npm install COPY . /main/bot LABEL name="cylane" version="1.5" # Start the bot. -CMD ["node", "./src/index.js"] \ No newline at end of file +CMD ["npm", "run", "start"] \ No newline at end of file diff --git a/application.example.yml b/application.example.yml index c34850d..97cc762 100644 --- a/application.example.yml +++ b/application.example.yml @@ -18,6 +18,7 @@ bot: ENABLE_MESSAGE: false AUTO_DEPLOY: true + PREFIX: "d!" lavalink: # Your spotify id and secret, you can get it from here: https://developer.spotify.com/ @@ -27,6 +28,9 @@ lavalink: SPOTIFY_SECRET: Your spotify secret DEFAULT: ["yorushika", "yoasobi", "tuyu", "hinkik"] + + # Enable this if you want to use lavalink info from .env files + ENV_NODE: false # You can add more lavalink server! NODES: [ diff --git a/docker-compose.yml b/docker-compose.yml index 5ff7fe6..2f6f562 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -41,6 +41,14 @@ services: depends_on: - lavalink - mongodb + environment: + - TOKEN=${TOKEN} + # Database + - MONGO_URI=mongodb://cylane:cylake@mongodb:27017/streamhatchet?directConnection=true&authSource=admin&replicaSet=replicaset&retryWrites=true + # Lavalink + - NODE_URL=lavalink:2333 + - NODE_NAME=Dreamvast_DOCKER + - NODE_AUTH=dreamvast networks: lavalink-net: diff --git a/src/client/sharding/manager.js b/src/client/sharding/manager.js index 93b780d..139d1c4 100644 --- a/src/client/sharding/manager.js +++ b/src/client/sharding/manager.js @@ -35,7 +35,7 @@ class Manager extends Client { this.config = require("../../plugins/config.js"); if (this.config.WEBSOCKET){ - logger.error("You cannot enable websocket on advanced shard system! To use ws, please run the bot in normal mode by type `npm run start:normal` or `npm start`") + logger.error("You cannot enable websocket on advanced shard system! To use ws, please run the bot in normal mode by type `npm run start:normal` or `npm start`\n To disable, use WEBSOCKET: false in application.yml files") process.exit() } diff --git a/src/plugins/config.js b/src/plugins/config.js index 287ce20..7e889b1 100644 --- a/src/plugins/config.js +++ b/src/plugins/config.js @@ -14,7 +14,7 @@ try { module.exports = { // Bot config - TOKEN: doc.bot.TOKEN || "YOUR_TOKEN", // your bot token + TOKEN: process.env.TOKEN || doc.bot.TOKEN || "YOUR_TOKEN", // your bot token EMBED_COLOR: doc.bot.EMBED_COLOR || "#c2e9ff", //<= default is "#c2e9ff" OWNER_ID: doc.bot.OWNER_ID || "YOUR_CLIENT_ID", //your owner discord id example: "515490955801919488" NP_REALTIME: doc.bot.NP_REALTIME || "BOOLEAN", // "true" = realtime, "false" = not realtime :3 // WARNING: on set to "true" = laggy and bot will ratelimit if you have a lot of servers @@ -24,7 +24,7 @@ module.exports = { directory: resolve("./src/languages"), // <= location of language }, DEV_ID: doc.bot.DEV_ID || [], // if you want to use command bot only, you can put your id here example: ["123456789", "123456789"] - MONGO_URI: doc.bot.MONGO_URI || "YOUR_MONGO_URI", // your mongo uri + MONGO_URI: process.env.MONGO_URI || doc.bot.MONGO_URI || "YOUR_MONGO_URI", // your mongo uri ENABLE_MESSAGE: doc.bot.ENABLE_MESSAGE || false, AUTO_DEPLOY: doc.bot.AUTO_DEPLOY || true, PREFIX: doc.bot.PREFIX || "d!", @@ -33,7 +33,15 @@ module.exports = { SPOTIFY_ID: doc.lavalink.SPOTIFY_ID, SPOTIFY_SECRET: doc.lavalink.SPOTIFY_SECRET, DEFAULT: doc.lavalink.DEFAULT || ["yorushika", "yoasobi", "tuyu", "hinkik"], - NODES: doc.lavalink.NODES || [ + NODES: doc.lavalink.ENV_NODE ? + [ + { + url: process.env.NODE_URL || 'lavalink-coders.ml:80', + name: process.env.NODE_NAME || 'Main (PROCESS.ENV)', + auth: process.env.NODE_AUTH || 'coders', + secure: parseBoolean(process.env.NODE_SECURE || 'false'), + }, + ] : doc.lavalink.NODES || [ { url: 'lavalink-coders.ml:80', name: 'Main', @@ -64,4 +72,17 @@ module.exports = { WEBSOCKET:doc.websocket.WEBSOCKET || false, AUTHENICATOR: doc.websocket.AUTHENICATOR || false, TRUSTED_ORIGIN: doc.websocket.TRUSTED_ORIGIN || ['http://localhost:3000'] +} + +function parseBoolean(value){ + if (typeof(value) === 'string'){ + value = value.trim().toLowerCase(); + } + switch(value){ + case true: + case "true": + return true; + default: + return false; + } } \ No newline at end of file