diff --git a/DOCKERFILE b/DOCKERFILE new file mode 100644 index 0000000..da34478 --- /dev/null +++ b/DOCKERFILE @@ -0,0 +1,4 @@ +FROM node:latest +WORKDIR /app +COPY . /app +CMD ["npm", "run", "start"] \ No newline at end of file diff --git a/README.md b/README.md index f05e4b9..0dcec2c 100644 --- a/README.md +++ b/README.md @@ -16,4 +16,9 @@ - Run `npm run dev` to run the dev mode - Tun `npm run build` to build the project -- Run `npm run start` to run the compiled code \ No newline at end of file +- Run `npm run start` to run the compiled code + +## Docker configuration + +- Change the service name and the full path to your bot in `docker-compose.yml` file +- Run `docker compose up` to run the container \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..0e158ee --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,10 @@ +version: '3.1' + +services: + service_name: + build: + context: . + dockerfile: DOCKERFILE + restart: always + volumes: + - /full/path/to/bot:/app \ No newline at end of file diff --git a/package.json b/package.json index da49522..9822c7b 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,8 @@ "main": "index.js", "scripts": { "dev": "tsx watch src", - "build": "tsc" + "build": "tsc", + "start": "node dist" }, "keywords": [], "author": "", diff --git a/src/index.ts b/src/index.ts index dbb4bf4..f4e87b8 100644 --- a/src/index.ts +++ b/src/index.ts @@ -17,7 +17,7 @@ for (const folder of commandFolders) { const commandsPath = path.join(foldersPath, folder); const commandFiles = fs .readdirSync(commandsPath) - .filter((file) => file.endsWith(".ts")); + .filter((file) => file.endsWith(".ts") || file.endsWith(".js")); for (const file of commandFiles) { const filePath = path.join(commandsPath, file); @@ -52,7 +52,7 @@ const rest = new REST().setToken(process.env.DISCORD_TOKEN ? process.env.DISCORD const eventsPath = path.join(__dirname, "events"); const eventFiles = fs .readdirSync(eventsPath) - .filter((file) => file.endsWith(".ts")); + .filter((file) => file.endsWith(".ts") || file.endsWith(".js")); for (const file of eventFiles) { const filePath = path.join(eventsPath, file);