Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge dev-src to Dev #107

Merged
merged 7 commits into from
Dec 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
.env
config.json
/node_modules
/test
/command-logs
/data/links.json
/src/command-logs
/src/data/links.json
6 changes: 3 additions & 3 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"skipFiles": [
"<node_internals>/**"
],
"program": "${workspaceFolder}/index.js"
"program": "${workspaceFolder}/src/index.js"
},
{
"name": "Deploy slash commands.",
Expand All @@ -20,7 +20,7 @@
"skipFiles": [
"<node_internals>/**"
],
"program": "${workspaceFolder}/deploy-commands.js"
"program": "${workspaceFolder}/src/deploy-commands.js"
},
{
"name": "Run unit tests.",
Expand All @@ -41,7 +41,7 @@
"skipFiles": [
"<node_internals>/**"
],
"program": "${workspaceFolder}/create-tables.js"
"program": "${workspaceFolder}/src/create-tables.js"
}
]
}
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ I'm hosting it, should be online 24/7.
Do the following for setting up the application from sratch:

1. Clone the repository.
2. Create a `.env` file, or rename the existing [.env.example](./.env.example) file, and fill it out with the required data.
3. Create a `config.json` file, or rename the existing [config.json.example](./config.json.example) file, and fill it out with the required configuration settings.
2. Create a `.env` file, or rename the existing [.env.example](./src/.env.example) file, and fill it out with the required data.
3. Create a `config.json` file, or rename the existing [config.json.example](./src/config.json.example) file, and fill it out with the required configuration settings.
4. Like you would with any other node.js app, install dependencies with with the `npm i` command.

### Setting up a database for the bot

Some of the bot's features **require a MariaDB database**.

If you already have a working database, and have filled up the connection details in the `.env` file for the connection, you can just run `npm run create-tables`. This will automatically create the tables based on the SQL queries that can be found in the [sql folder](sql/).
If you already have a working database, and have filled up the connection details in the `.env` file for the connection, you can just run `npm run create-tables`. This will automatically create the tables based on the SQL queries that can be found in the [sql folder](./src/sql/).

Otherwise, please refer to [THIS](documentation/mariadb-setup.md) documentation for addittional help about setting up a database.

Expand All @@ -44,4 +44,4 @@ If everything above checks out, you can prepare for the first run:

#### Running it in the background

If you want to run the application on a Linux system in the background as a systemd service, you can follow [THIS](documentation/systemd-setup.md) guide.
If you want to run the application on a Linux system in the background as a systemd service, you can follow [THIS](documentation/systemd-setup.md) guide.
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@
"nodemon": "^3.0.2"
},
"scripts": {
"app": "node index.js",
"dev": "nodemon index.js",
"deploy": "node deploy-commands.js",
"create-tables": "node create-tables.js",
"verify-config": "node ./scripts/verify-config-syntax.js",
"app": "node ./src/index.js",
"dev": "nodemon ./src/index.js",
"deploy": "node ./src/deploy-commands.js",
"create-tables": "node ./src/create-tables.js",
"verify-config": "node ./src/scripts/verify-config-syntax.js",
"test": "jest"
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const db = require("../../../helpers/db");
const { embedColors } = require("../../../config.json");
const { embedColors } = require("../../../../config.json");
const { embedMessage } = require("../../../helpers/embeds/embed-message");

module.exports = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const db = require("../../../helpers/db");
const { embedColors } = require("../../../config.json");
const { embedColors } = require("../../../../config.json");
const { embedMessage } = require("../../../helpers/embeds/embed-message");

module.exports = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const db = require("../../../helpers/db");
const { logMessagesToLocalDatabase } = require("../../../config.json");
const { logMessagesToLocalDatabase } = require("../../../../config.json");

module.exports = {
async logMessagesToLocalDatabase(message) {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { EmbedBuilder } = require("discord.js");
const { embedColors } = require("../../config.json");
const { embedColors } = require("../../../config.json");

/**
* @param {color} color - Embed's sidebar HEX Color
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { EmbedBuilder } = require("discord.js");
const { embedColors } = require("../../config.json");
const { embedColors } = require("../../../config.json");

/**
* @param {title} title - Embed's title
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { EmbedBuilder } = require("discord.js");
const { embedColors } = require("../../config.json");
const { embedColors } = require("../../../config.json");

/**
* @param {color} color - Embed's sidebar HEX Color
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion helpers/logger.js → src/helpers/logger.js
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const fs = require("fs");
const path = require("path");
const db = require("./db");
const { logToFile, logToDatabase } = require("../config.json");
const { logToFile, logToDatabase } = require("../../config.json");

const logDirectory = path.join(__dirname, "../command-logs");

Expand Down
0 index.js → src/index.js
100755 → 100644
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const fs = require("fs");
const path = require("path");
const Ajv = require("ajv");

const configPath = path.join(__dirname, "..", "config.json");
const configPath = path.join(__dirname, "..", "..", "config.json");
const configSchemaPath = path.join(__dirname, "config-schema.json");

const config = JSON.parse(fs.readFileSync(configPath, "utf-8"));
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
jest.mock('../config.json', () => ({
jest.mock('../../config.json', () => ({
databaseHostAddress: 'mock-host',
databaseName: 'mock-db',
databaseUser: 'mock-user',
Expand Down
File renamed without changes.