mirror of
https://github.com/Alee14/AleeBot.git
synced 2025-01-22 11:11:46 -05:00
Compare commits
2 commits
7e65ae0e13
...
de5ee661ca
Author | SHA1 | Date | |
---|---|---|---|
de5ee661ca | |||
9b484f3f18 |
15 changed files with 862 additions and 649 deletions
|
@ -3,3 +3,4 @@ npm-debug.log
|
|||
.git
|
||||
.env
|
||||
database.sqlite
|
||||
web
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
FROM node:alpine
|
||||
FROM node:latest
|
||||
|
||||
WORKDIR /usr/src/bot
|
||||
|
||||
RUN apt-get update && apt-get install -y build-essential libtool autoconf automake python3
|
||||
|
||||
COPY package.json ./
|
||||
|
||||
COPY yarn.lock ./
|
||||
|
@ -10,4 +12,5 @@ RUN yarn install
|
|||
|
||||
COPY . .
|
||||
|
||||
CMD ["node", "bot_discord.js"]
|
||||
ENTRYPOINT ["node", "bot_discord.js"]
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
const express = require('express');
|
||||
const cors = require('cors');
|
||||
const quotesRouter = require('./routes/quotes');
|
||||
require('dotenv').config()
|
||||
|
||||
const app = express();
|
||||
const PORT = 3000;
|
||||
|
||||
const createServer = () => {
|
||||
app.use(cors()); // Allow cross-origin requests
|
||||
|
@ -18,8 +18,8 @@ const createServer = () => {
|
|||
});
|
||||
|
||||
// Start the server
|
||||
app.listen(PORT, () => {
|
||||
console.log(`Server is running on http://localhost:${PORT}`);
|
||||
app.listen(process.env.port, () => {
|
||||
console.log(`Server is running on http://localhost:${process.env.port}`);
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
@ -124,9 +124,9 @@ rl.on('line', function(cmd) {
|
|||
console.log(('[!] No guilds found.'.yellow));
|
||||
} else {
|
||||
console.log('[i] These are the servers that AleeBot is connected to:');
|
||||
for ([id, guild] of client.guilds) {
|
||||
client.guilds.cache.forEach((guild) => {
|
||||
console.log(` Guild Name: ${guild.name} - ID: ${guild.id}`.blue);
|
||||
}
|
||||
});
|
||||
}
|
||||
break;
|
||||
case 'leave':
|
||||
|
|
|
@ -50,24 +50,6 @@ module.exports.run = async (client, message) => {
|
|||
});
|
||||
}
|
||||
|
||||
async function imageCheck(message) {
|
||||
const attachment = message.attachments.first();
|
||||
if (attachment) {
|
||||
const fileExtension = attachment.name.split('.').pop().toLowerCase();
|
||||
if (['jpg', 'png', 'jpeg'].includes(fileExtension)) {
|
||||
newAuthorImage = attachment.url.toString(); // Use the attachment's URL directly
|
||||
} else {
|
||||
await dmChannel.send('Invalid file type. Please attach a .jpg or .png image.');
|
||||
return await imageCheck(message);
|
||||
}
|
||||
} else if (msg.content.startsWith('http') && (message.content.endsWith('.jpg') || message.content.endsWith('.jpeg') || message.content.endsWith('.png'))) {
|
||||
newAuthorImage = msg.content; // Use the provided URL
|
||||
} else {
|
||||
await dmChannel.send('Invalid input. Please provide an image URL or attach an image file.');
|
||||
return await imageCheck(message);
|
||||
}
|
||||
}
|
||||
|
||||
let setupMessage = "Welcome to the AleeBot Quote Setup!\n";
|
||||
setupMessage += "Please follow these rules when submitting quotes:\n";
|
||||
setupMessage += "```1. No offensive content (NSFW, Racism, etc).\n";
|
||||
|
@ -92,7 +74,23 @@ module.exports.run = async (client, message) => {
|
|||
|
||||
collector.on('collect', async (msg) => {
|
||||
if (counter === 2) { // Collecting author image
|
||||
await imageCheck(msg);
|
||||
const attachment = msg.attachments.first();
|
||||
if (attachment) {
|
||||
const fileExtension = attachment.name.split('.').pop().toLowerCase();
|
||||
if (['jpg', 'png', 'jpeg'].includes(fileExtension)) {
|
||||
newAuthorImage = attachment.url.toString(); // Use the attachment's URL directly
|
||||
} else {
|
||||
await dmChannel.send('Invalid file type. Please attach a .jpg or .png image.');
|
||||
collector.stop();
|
||||
return;
|
||||
}
|
||||
} else if (msg.content.startsWith('http') && (msg.content.endsWith('.jpg') || msg.content.endsWith('.jpeg') || msg.content.endsWith('.png'))) {
|
||||
newAuthorImage = message.content;
|
||||
} else {
|
||||
await dmChannel.send('Invalid input. Please provide an image URL or attach an image file.');
|
||||
collector.stop();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (counter < setupProcess.length) {
|
||||
|
@ -150,7 +148,19 @@ module.exports.run = async (client, message) => {
|
|||
case '📷':
|
||||
await dmChannel.send('You selected the author image. Please provide the image URL or attach an image file.');
|
||||
const imageResponse = await dmChannel.awaitMessages({ filter, max: 1, time: 60000 });
|
||||
await imageCheck(imageResponse.first());
|
||||
const attachment = imageResponse.first().attachments.first();
|
||||
if (attachment) {
|
||||
const fileExtension = attachment.name.split('.').pop().toLowerCase();
|
||||
if (['jpg', 'png', 'jpeg'].includes(fileExtension)) {
|
||||
newAuthorImage = attachment.url.toString(); // Use the attachment's URL directly
|
||||
} else {
|
||||
await dmChannel.send('Invalid file type. Please attach a .jpg or .png image.');
|
||||
}
|
||||
} else if (imageResponse.first().content.startsWith('http') && (imageResponse.first().content.endsWith('.jpg') || imageResponse.first().content.endsWith('.jpeg') || imageResponse.first().content.endsWith('.png'))) {
|
||||
newAuthorImage = message.content;
|
||||
} else {
|
||||
await dmChannel.send('Invalid input. Please provide an image URL or attach an image file.');
|
||||
}
|
||||
await dmChannel.send('Updated author image.');
|
||||
break;
|
||||
case '🖋️':
|
||||
|
@ -191,7 +201,7 @@ module.exports.run = async (client, message) => {
|
|||
}
|
||||
});
|
||||
} catch (error) {
|
||||
message.author.send('An error occurred while setting up the quote. Please try again.');
|
||||
await message.author.send('An error occurred while setting up the quote. Please rerun the command.');
|
||||
setupUsers.delete(message.author.id);
|
||||
console.error(error);
|
||||
}
|
||||
|
|
|
@ -38,10 +38,6 @@ module.exports.run = async (client, message, args) => {
|
|||
.setColor('#1fd619')
|
||||
.setFooter('- ' + quote.year);
|
||||
|
||||
if (quote.url) {
|
||||
quoteEmbed.setURL(quote.url);
|
||||
}
|
||||
|
||||
await message.reply({ embeds: [quoteEmbed] })
|
||||
} else {
|
||||
message.reply('Cannot find quote, specify the correct quote id.');
|
||||
|
|
14
docker-compose.yml
Normal file
14
docker-compose.yml
Normal file
|
@ -0,0 +1,14 @@
|
|||
services:
|
||||
aleebot:
|
||||
image: aleebot
|
||||
volumes:
|
||||
- ./database.sqlite:/usr/src/bot/database.sqlite
|
||||
- ./.env:/usr/src/bot/.env
|
||||
ports:
|
||||
- "3000:3000"
|
||||
web:
|
||||
image: aleebot-web
|
||||
environment:
|
||||
- HOST=0.0.0.0
|
||||
ports:
|
||||
- "4321:4321"
|
|
@ -23,10 +23,6 @@ const quote = sequelize.define('quotes', {
|
|||
type: Sequelize.STRING,
|
||||
allowNull: false
|
||||
},
|
||||
url: {
|
||||
type: Sequelize.STRING,
|
||||
allowNull: true
|
||||
},
|
||||
submitter: {
|
||||
type: Sequelize.STRING,
|
||||
allowNull: false
|
||||
|
@ -56,10 +52,6 @@ const pendingQuote = sequelize.define('pending-quotes', {
|
|||
type: Sequelize.STRING,
|
||||
allowNull: false
|
||||
},
|
||||
url: {
|
||||
type: Sequelize.STRING,
|
||||
allowNull: true
|
||||
},
|
||||
submitterAuthor: {
|
||||
type: Sequelize.STRING,
|
||||
allowNull: false
|
||||
|
|
22
package.json
22
package.json
|
@ -19,19 +19,19 @@
|
|||
"homepage": "https://github.com/Alee14/AleeBot#readme",
|
||||
"dependencies": {
|
||||
"blessed": "^0.1.81",
|
||||
"colors": "^1.3.0",
|
||||
"colors": "^1.4.0",
|
||||
"cors": "^2.8.5",
|
||||
"discord.js": "^13.0.1",
|
||||
"dotenv": "^16.3.1",
|
||||
"eslint": "^7.1.0",
|
||||
"express": "^4.17.1",
|
||||
"i18next": "^19.4.4",
|
||||
"moment": "^2.21.0",
|
||||
"os": "^0.1.1",
|
||||
"parse-ms": "^1.0.1",
|
||||
"discord.js": "13.17.1",
|
||||
"dotenv": "^16.4.7",
|
||||
"eslint": "^9.18.0",
|
||||
"express": "^4.21.2",
|
||||
"i18next": "^24.2.1",
|
||||
"moment": "^2.30.1",
|
||||
"os": "^0.1.2",
|
||||
"parse-ms": "^4.0.0",
|
||||
"readline": "^1.3.0",
|
||||
"sequelize": "^6.30.0",
|
||||
"sqlite3": "^5.1.6"
|
||||
"sequelize": "^6.37.5",
|
||||
"sqlite3": "^5.1.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
"nodemon": "^2.0.2"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{
|
||||
"abVersion": "2.13.0 Beta",
|
||||
"prefix": "abb:"
|
||||
"prefix": "ab:"
|
||||
}
|
||||
|
|
9
web/Dockerfile
Normal file
9
web/Dockerfile
Normal file
|
@ -0,0 +1,9 @@
|
|||
FROM oven/bun:latest
|
||||
|
||||
WORKDIR /web
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN bun run build
|
||||
|
||||
ENTRYPOINT ["bun", "run", "/web/dist/server/entry.mjs"]
|
|
@ -3,7 +3,13 @@ import { defineConfig } from 'astro/config';
|
|||
|
||||
import react from '@astrojs/react';
|
||||
|
||||
import node from '@astrojs/node';
|
||||
|
||||
// https://astro.build/config
|
||||
export default defineConfig({
|
||||
integrations: [react()]
|
||||
integrations: [react()],
|
||||
|
||||
adapter: node({
|
||||
mode: 'standalone'
|
||||
})
|
||||
});
|
||||
|
|
BIN
web/bun.lockb
BIN
web/bun.lockb
Binary file not shown.
|
@ -9,6 +9,7 @@
|
|||
"astro": "astro"
|
||||
},
|
||||
"dependencies": {
|
||||
"@astrojs/node": "^9.0.0",
|
||||
"@astrojs/react": "^4.1.3",
|
||||
"@types/react": "^19.0.4",
|
||||
"@types/react-dom": "^19.0.2",
|
||||
|
|
Loading…
Reference in a new issue