feat: now compatible with kubernetes and docker :3
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -2,3 +2,4 @@ config.json
|
|||||||
node_modules/
|
node_modules/
|
||||||
downloads/
|
downloads/
|
||||||
stickers/
|
stickers/
|
||||||
|
kube/
|
@@ -1,13 +1,13 @@
|
|||||||
FROM node:latest
|
FROM node:latest
|
||||||
|
|
||||||
# Working dir
|
# Working dir
|
||||||
RUN mkdir -p /usr/src/bot
|
RUN mkdir -p /emot/app
|
||||||
WORKDIR /usr/src/bot
|
WORKDIR /emot/app
|
||||||
|
|
||||||
# Install bot
|
# Install bot
|
||||||
COPY package.json /usr/src/bot
|
COPY package.json /emot/app
|
||||||
RUN npm install
|
RUN npm install
|
||||||
COPY . /usr/src/bot/
|
COPY . /emot/app
|
||||||
|
|
||||||
# Start the bot
|
# Start the bot
|
||||||
CMD ["node", "index.js"]
|
CMD ["node", "index.js"]
|
@@ -1,5 +1,6 @@
|
|||||||
const { SlashCommandBuilder } = require("discord.js");
|
const { SlashCommandBuilder } = require("discord.js");
|
||||||
const fs = require('fs/promises');
|
const fs = require('fs/promises');
|
||||||
|
const { EMOTE_DIR } = process.env;
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
@@ -25,7 +26,7 @@ module.exports = {
|
|||||||
const copyname = match.groups.name + "_FE";
|
const copyname = match.groups.name + "_FE";
|
||||||
const response = await fetch(link);
|
const response = await fetch(link);
|
||||||
// save the file
|
// 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`);
|
await interaction.editReply(`Dowloaded ${match[0]}!\n`);
|
||||||
replyMessage += `Logged ${match[0]}!\n`;
|
replyMessage += `Logged ${match[0]}!\n`;
|
||||||
}
|
}
|
@@ -1,5 +1,6 @@
|
|||||||
const { ContextMenuCommandBuilder, ApplicationCommandType, StickerFormatType } = require("discord.js");
|
const { ContextMenuCommandBuilder, ApplicationCommandType, StickerFormatType } = require("discord.js");
|
||||||
const fs = require('fs/promises');
|
const fs = require('fs/promises');
|
||||||
|
const { STICKER_DIR } = process.env;
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
data : new ContextMenuCommandBuilder()
|
data : new ContextMenuCommandBuilder()
|
||||||
@@ -20,7 +21,7 @@ module.exports = {
|
|||||||
(sticker.format == StickerFormatType.APNG) ? ".apng" :
|
(sticker.format == StickerFormatType.APNG) ? ".apng" :
|
||||||
(sticker.format == StickerFormatType.LOTTIE) ? ".json" : ".webp";
|
(sticker.format == StickerFormatType.LOTTIE) ? ".json" : ".webp";
|
||||||
// save the file
|
// 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`);
|
await interaction.editReply(`Dowloaded ${sticker.name}!\n`);
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -1,5 +1,5 @@
|
|||||||
const { REST, Routes } = require('discord.js');
|
const { REST, Routes } = require('discord.js');
|
||||||
const { clientId, token } = require('./config.json');
|
const { CLIENT_ID, TOKEN } = process.env;
|
||||||
const fs = require('node:fs');
|
const fs = require('node:fs');
|
||||||
const path = require('node:path');
|
const path = require('node:path');
|
||||||
|
|
||||||
@@ -25,7 +25,7 @@ for (const folder of commandFolders) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Construct and prepare an instance of the REST module
|
// 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!
|
// and deploy your commands!
|
||||||
(async () => {
|
(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
|
// The put method is used to fully refresh all commands in the guild with the current set
|
||||||
const data = await rest.put(
|
const data = await rest.put(
|
||||||
Routes.applicationCommands(clientId),
|
Routes.applicationCommands(CLIENT_ID),
|
||||||
{ body: commands },
|
{ body: commands },
|
||||||
);
|
);
|
||||||
|
|
@@ -1,7 +1,7 @@
|
|||||||
const fs = require('node:fs');
|
const fs = require('node:fs');
|
||||||
const path = require('node:path');
|
const path = require('node:path');
|
||||||
const { Client, Collection, Events, GatewayIntentBits } = require('discord.js');
|
const { Client, Collection, Events, GatewayIntentBits } = require('discord.js');
|
||||||
const { token } = require('./config.json');
|
const { TOKEN } = process.env;
|
||||||
|
|
||||||
const client = new Client({ intents: [GatewayIntentBits.Guilds] });
|
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