diff --git a/.gitignore b/.gitignore index dabc6e9..03184bf 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ config.json node_modules/ downloads/ -stickers/ \ No newline at end of file +stickers/ +kube/ \ No newline at end of file diff --git a/Dockerfile b/bot/Dockerfile similarity index 51% rename from Dockerfile rename to bot/Dockerfile index 3fa1598..81b0cda 100644 --- a/Dockerfile +++ b/bot/Dockerfile @@ -1,13 +1,13 @@ FROM node:latest # Working dir -RUN mkdir -p /usr/src/bot -WORKDIR /usr/src/bot +RUN mkdir -p /emot/app +WORKDIR /emot/app # Install bot -COPY package.json /usr/src/bot +COPY package.json /emot/app RUN npm install -COPY . /usr/src/bot/ +COPY . /emot/app # Start the bot CMD ["node", "index.js"] \ No newline at end of file diff --git a/commands/emotes/dl.js b/bot/commands/emotes/dl.js similarity index 93% rename from commands/emotes/dl.js rename to bot/commands/emotes/dl.js index 12e461b..e5621c9 100644 --- a/commands/emotes/dl.js +++ b/bot/commands/emotes/dl.js @@ -1,5 +1,6 @@ const { SlashCommandBuilder } = require("discord.js"); const fs = require('fs/promises'); +const { EMOTE_DIR } = process.env; module.exports = { data: new SlashCommandBuilder() @@ -25,7 +26,7 @@ module.exports = { const copyname = match.groups.name + "_FE"; const response = await fetch(link); // save the file - await fs.writeFile(`./downloads/${copyname}${(match.groups.animated == 'a') ? ".gif": ".webp"}`, response.body); + await fs.writeFile(`${EMOTE_DIR}${copyname}${(match.groups.animated == 'a') ? ".gif": ".webp"}`, response.body); await interaction.editReply(`Dowloaded ${match[0]}!\n`); replyMessage += `Logged ${match[0]}!\n`; } diff --git a/commands/emotes/emotelog.js b/bot/commands/emotes/emotelog.js similarity index 100% rename from commands/emotes/emotelog.js rename to bot/commands/emotes/emotelog.js diff --git a/commands/emotes/list.js b/bot/commands/emotes/list.js similarity index 100% rename from commands/emotes/list.js rename to bot/commands/emotes/list.js diff --git a/commands/emotes/rm.js b/bot/commands/emotes/rm.js similarity index 100% rename from commands/emotes/rm.js rename to bot/commands/emotes/rm.js diff --git a/commands/emotes/stickerlog.js b/bot/commands/emotes/stickerlog.js similarity index 89% rename from commands/emotes/stickerlog.js rename to bot/commands/emotes/stickerlog.js index 1d59520..d35f79c 100644 --- a/commands/emotes/stickerlog.js +++ b/bot/commands/emotes/stickerlog.js @@ -1,5 +1,6 @@ const { ContextMenuCommandBuilder, ApplicationCommandType, StickerFormatType } = require("discord.js"); const fs = require('fs/promises'); +const { STICKER_DIR } = process.env; module.exports = { data : new ContextMenuCommandBuilder() @@ -20,7 +21,7 @@ module.exports = { (sticker.format == StickerFormatType.APNG) ? ".apng" : (sticker.format == StickerFormatType.LOTTIE) ? ".json" : ".webp"; // save the file - await fs.writeFile(`./stickers/${copyname}${extension}`, response.body); + await fs.writeFile(`${STICKER_DIR}${copyname}${extension}`, response.body); await interaction.editReply(`Dowloaded ${sticker.name}!\n`); } } \ No newline at end of file diff --git a/commands/utils/ping.js b/bot/commands/utils/ping.js similarity index 100% rename from commands/utils/ping.js rename to bot/commands/utils/ping.js diff --git a/deploy-commands.js b/bot/deploy-commands.js similarity index 91% rename from deploy-commands.js rename to bot/deploy-commands.js index 51ee278..78f4e32 100644 --- a/deploy-commands.js +++ b/bot/deploy-commands.js @@ -1,5 +1,5 @@ const { REST, Routes } = require('discord.js'); -const { clientId, token } = require('./config.json'); +const { CLIENT_ID, TOKEN } = process.env; const fs = require('node:fs'); const path = require('node:path'); @@ -25,7 +25,7 @@ for (const folder of commandFolders) { } // Construct and prepare an instance of the REST module -const rest = new REST().setToken(token); +const rest = new REST().setToken(TOKEN); // and deploy your commands! (async () => { @@ -34,7 +34,7 @@ const rest = new REST().setToken(token); // The put method is used to fully refresh all commands in the guild with the current set const data = await rest.put( - Routes.applicationCommands(clientId), + Routes.applicationCommands(CLIENT_ID), { body: commands }, ); diff --git a/dev/clonesticker.js b/bot/dev/clonesticker.js similarity index 100% rename from dev/clonesticker.js rename to bot/dev/clonesticker.js diff --git a/events/interactionCreate.js b/bot/events/interactionCreate.js similarity index 100% rename from events/interactionCreate.js rename to bot/events/interactionCreate.js diff --git a/events/ready.js b/bot/events/ready.js similarity index 100% rename from events/ready.js rename to bot/events/ready.js diff --git a/index.js b/bot/index.js similarity index 95% rename from index.js rename to bot/index.js index 5eb13bc..30702be 100644 --- a/index.js +++ b/bot/index.js @@ -1,7 +1,7 @@ const fs = require('node:fs'); const path = require('node:path'); const { Client, Collection, Events, GatewayIntentBits } = require('discord.js'); -const { token } = require('./config.json'); +const { TOKEN } = process.env; const client = new Client({ intents: [GatewayIntentBits.Guilds] }); @@ -39,4 +39,4 @@ for (const file of eventFiles) { } } -client.login(token); +client.login(TOKEN); diff --git a/package-lock.json b/bot/package-lock.json similarity index 100% rename from package-lock.json rename to bot/package-lock.json diff --git a/package.json b/bot/package.json similarity index 100% rename from package.json rename to bot/package.json