feat: now compatible with kubernetes and docker :3
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,4 +1,5 @@
|
||||
config.json
|
||||
node_modules/
|
||||
downloads/
|
||||
stickers/
|
||||
stickers/
|
||||
kube/
|
@@ -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"]
|
@@ -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`;
|
||||
}
|
@@ -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`);
|
||||
}
|
||||
}
|
@@ -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 },
|
||||
);
|
||||
|
@@ -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);
|
0
package-lock.json → bot/package-lock.json
generated
0
package-lock.json → bot/package-lock.json
generated
Reference in New Issue
Block a user