From 79218c9e676626d38784082a4d151d0efd4ff933 Mon Sep 17 00:00:00 2001 From: Evorp <3vorpgaming@gmail.com> Date: Mon, 26 Aug 2024 21:56:34 -0700 Subject: [PATCH] move everything to src folder --- package.json | 10 +++---- pnpm-lock.yaml | 28 +++++++++---------- {commands => src/commands}/bot/feedback.ts | 0 {commands => src/commands}/bot/ping.ts | 0 {commands => src/commands}/bot/status.ts | 0 .../commands}/developer/backup.ts | 0 .../commands}/developer/behave.ts | 0 {commands => src/commands}/developer/eval.ts | 0 .../commands}/developer/restart.ts | 0 {commands => src/commands}/developer/say.ts | 0 .../commands}/developer/shutdown.ts | 0 .../commands}/submission/autopush.ts | 0 .../commands}/submission/channelpush.ts | 0 {events => src/events}/buttonUsed.ts | 0 {events => src/events}/interactionCreate.ts | 0 {events => src/events}/messageCreate.ts | 0 {events => src/events}/messageReactionAdd.ts | 0 {events => src/events}/modalSubmit.ts | 0 {events => src/events}/ready.ts | 0 {events => src/events}/slashCommandUsed.ts | 0 {events => src/events}/threadCreate.ts | 0 .../functions}/commandHandler.ts | 0 {functions => src/functions}/feedback.ts | 0 {functions => src/functions}/fetchSettings.ts | 0 {functions => src/functions}/handleError.ts | 0 .../functions}/images/GIFEncoder.ts | 0 .../functions}/images/animate.ts | 0 .../functions}/images/difference.ts | 0 .../functions}/images/magnify.ts | 0 .../functions}/images/palette.ts | 0 {functions => src/functions}/images/stitch.ts | 0 {functions => src/functions}/images/tile.ts | 0 {functions => src/functions}/pushToGitHub.ts | 0 {functions => src/functions}/saveDB.ts | 0 .../functions}/submission/handleResults.ts | 7 +++-- .../functions}/submission/makeEmbed.ts | 0 .../functions}/submission/pushTextures.ts | 3 +- .../functions}/submission/reactionMenu.ts | 0 .../functions}/submission/sendToChannel.ts | 0 .../functions}/submission/submitTexture.ts | 0 .../submission/utility/cancelSubmission.ts | 0 .../submission/utility/changeStatus.ts | 0 .../submission/utility/choiceEmbed.ts | 0 .../submission/utility/generateComparison.ts | 0 .../submission/utility/getAuthors.ts | 0 .../submission/utility/getPackByChannel.ts | 0 .../submission/utility/instapass.ts | 0 .../submission/utility/invalidate.ts | 0 .../submission/utility/retrieveSubmission.ts | 0 {helpers => src/helpers}/addDeleteButton.ts | 0 {helpers => src/helpers}/devLogger.ts | 0 {helpers => src/helpers}/formattedDate.ts | 0 {helpers => src/helpers}/getImages.ts | 0 {helpers => src/helpers}/getMessages.ts | 0 {helpers => src/helpers}/interactions.ts | 0 {helpers => src/helpers}/minecraftSorter.ts | 0 {helpers => src/helpers}/permissions.ts | 0 {helpers => src/helpers}/walkSync.ts | 0 {helpers => src/helpers}/warnUser.ts | 0 index.ts => src/index.ts | 5 ++-- {interfaces => src/interfaces}/database.ts | 0 {interfaces => src/interfaces}/discord.ts | 0 {interfaces => src/interfaces}/images.ts | 0 tsconfig.json | 4 +-- 64 files changed, 30 insertions(+), 27 deletions(-) rename {commands => src/commands}/bot/feedback.ts (100%) rename {commands => src/commands}/bot/ping.ts (100%) rename {commands => src/commands}/bot/status.ts (100%) rename {commands => src/commands}/developer/backup.ts (100%) rename {commands => src/commands}/developer/behave.ts (100%) rename {commands => src/commands}/developer/eval.ts (100%) rename {commands => src/commands}/developer/restart.ts (100%) rename {commands => src/commands}/developer/say.ts (100%) rename {commands => src/commands}/developer/shutdown.ts (100%) rename {commands => src/commands}/submission/autopush.ts (100%) rename {commands => src/commands}/submission/channelpush.ts (100%) rename {events => src/events}/buttonUsed.ts (100%) rename {events => src/events}/interactionCreate.ts (100%) rename {events => src/events}/messageCreate.ts (100%) rename {events => src/events}/messageReactionAdd.ts (100%) rename {events => src/events}/modalSubmit.ts (100%) rename {events => src/events}/ready.ts (100%) rename {events => src/events}/slashCommandUsed.ts (100%) rename {events => src/events}/threadCreate.ts (100%) rename {functions => src/functions}/commandHandler.ts (100%) rename {functions => src/functions}/feedback.ts (100%) rename {functions => src/functions}/fetchSettings.ts (100%) rename {functions => src/functions}/handleError.ts (100%) rename {functions => src/functions}/images/GIFEncoder.ts (100%) rename {functions => src/functions}/images/animate.ts (100%) rename {functions => src/functions}/images/difference.ts (100%) rename {functions => src/functions}/images/magnify.ts (100%) rename {functions => src/functions}/images/palette.ts (100%) rename {functions => src/functions}/images/stitch.ts (100%) rename {functions => src/functions}/images/tile.ts (100%) rename {functions => src/functions}/pushToGitHub.ts (100%) rename {functions => src/functions}/saveDB.ts (100%) rename {functions => src/functions}/submission/handleResults.ts (96%) rename {functions => src/functions}/submission/makeEmbed.ts (100%) rename {functions => src/functions}/submission/pushTextures.ts (95%) rename {functions => src/functions}/submission/reactionMenu.ts (100%) rename {functions => src/functions}/submission/sendToChannel.ts (100%) rename {functions => src/functions}/submission/submitTexture.ts (100%) rename {functions => src/functions}/submission/utility/cancelSubmission.ts (100%) rename {functions => src/functions}/submission/utility/changeStatus.ts (100%) rename {functions => src/functions}/submission/utility/choiceEmbed.ts (100%) rename {functions => src/functions}/submission/utility/generateComparison.ts (100%) rename {functions => src/functions}/submission/utility/getAuthors.ts (100%) rename {functions => src/functions}/submission/utility/getPackByChannel.ts (100%) rename {functions => src/functions}/submission/utility/instapass.ts (100%) rename {functions => src/functions}/submission/utility/invalidate.ts (100%) rename {functions => src/functions}/submission/utility/retrieveSubmission.ts (100%) rename {helpers => src/helpers}/addDeleteButton.ts (100%) rename {helpers => src/helpers}/devLogger.ts (100%) rename {helpers => src/helpers}/formattedDate.ts (100%) rename {helpers => src/helpers}/getImages.ts (100%) rename {helpers => src/helpers}/getMessages.ts (100%) rename {helpers => src/helpers}/interactions.ts (100%) rename {helpers => src/helpers}/minecraftSorter.ts (100%) rename {helpers => src/helpers}/permissions.ts (100%) rename {helpers => src/helpers}/walkSync.ts (100%) rename {helpers => src/helpers}/warnUser.ts (100%) rename index.ts => src/index.ts (91%) rename {interfaces => src/interfaces}/database.ts (100%) rename {interfaces => src/interfaces}/discord.ts (100%) rename {interfaces => src/interfaces}/images.ts (100%) diff --git a/package.json b/package.json index 32c3e4bd..89562a8b 100644 --- a/package.json +++ b/package.json @@ -2,21 +2,21 @@ "name": "complibot-submissions", "version": "1.0.0", "description": "Fully automated texture pushing and submission system for the Faithful Discord servers.", - "main": "index.ts", + "main": "src/index.ts", "scripts": { - "start": "node -r ts-node/register -r tsconfig-paths/register index.ts", - "dev": "nodemon -r tsconfig-paths/register --ignore resources/ --ignore backups/ index.ts", + "start": "node -r ts-node/register -r tsconfig-paths/register src/index.ts", + "dev": "nodemon -r tsconfig-paths/register --ignore resources/ --ignore backups/ src/index.ts", "prettier": "prettier \"{,!(node_modules)/**/}*.ts\" --config .prettierrc --write" }, "devDependencies": { - "@types/node": "^22.4.1", + "@types/node": "^22.5.0", "nodemon": "^3.1.4", "prettier": "^3.3.3" }, "dependencies": { "@napi-rs/canvas": "^0.1.54", "@octokit/rest": "^20.1.1", - "axios": "^1.7.4", + "axios": "^1.7.5", "cron": "^3.1.7", "discord.js": "^14.15.3", "dotenv": "^16.4.5", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5e821c6f..e146b61a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -15,8 +15,8 @@ importers: specifier: ^20.1.1 version: 20.1.1 axios: - specifier: ^1.7.4 - version: 1.7.4 + specifier: ^1.7.5 + version: 1.7.5 cron: specifier: ^3.1.7 version: 3.1.7 @@ -31,14 +31,14 @@ importers: version: 1.0.5 ts-node: specifier: ^10.9.2 - version: 10.9.2(@types/node@22.4.1)(typescript@5.5.4) + version: 10.9.2(@types/node@22.5.0)(typescript@5.5.4) tsconfig-paths: specifier: ^4.2.0 version: 4.2.0 devDependencies: '@types/node': - specifier: ^22.4.1 - version: 22.4.1 + specifier: ^22.5.0 + version: 22.5.0 nodemon: specifier: ^3.1.4 version: 3.1.4 @@ -227,8 +227,8 @@ packages: '@types/luxon@3.4.2': resolution: {integrity: sha512-TifLZlFudklWlMBfhubvgqTXRzLDI5pCbGa4P8a3wPyUQSW+1xQ5eDsreP9DWHX3tjq1ke96uYG/nwundroWcA==} - '@types/node@22.4.1': - resolution: {integrity: sha512-1tbpb9325+gPnKK0dMm+/LMriX0vKxf6RnB0SZUqfyVkQ4fMgUSySqhxE/y8Jvs4NyF1yHzTfG9KlnkIODxPKg==} + '@types/node@22.5.0': + resolution: {integrity: sha512-DkFrJOe+rfdHTqqMg0bSNlGlQ85hSoh2TPzZyhHsXnMtligRWpxUySiyw8FY14ITt24HVCiQPWxS3KO/QlGmWg==} '@types/ws@8.5.12': resolution: {integrity: sha512-3tPRkv1EtkDpzlgyKyI8pGsGZAGPEaXeu0DOj5DI25Ja91bdAYddYHbADRYVrZMRbfW+1l5YwXVDKohDJNQxkQ==} @@ -256,8 +256,8 @@ packages: asynckit@0.4.0: resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==} - axios@1.7.4: - resolution: {integrity: sha512-DukmaFRnY6AzAALSH4J2M3k6PkaC+MfaAGdEERRWcC9q3/TWQwLpHR8ZRLKTdQ3aBDL64EdluRDjJqKw+BPZEw==} + axios@1.7.5: + resolution: {integrity: sha512-fZu86yCo+svH3uqJ/yTdQ0QHpQu5oL+/QE+QPSv6BZSkDAoky9vytxp7u5qk83OJFS3kEBcesWni9WTZAv3tSw==} balanced-match@1.0.2: resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} @@ -720,13 +720,13 @@ snapshots: '@types/luxon@3.4.2': {} - '@types/node@22.4.1': + '@types/node@22.5.0': dependencies: undici-types: 6.19.8 '@types/ws@8.5.12': dependencies: - '@types/node': 22.4.1 + '@types/node': 22.5.0 '@vladfrangu/async_event_emitter@2.4.5': {} @@ -745,7 +745,7 @@ snapshots: asynckit@0.4.0: {} - axios@1.7.4: + axios@1.7.5: dependencies: follow-redirects: 1.15.6 form-data: 4.0.0 @@ -943,14 +943,14 @@ snapshots: ts-mixer@6.0.4: {} - ts-node@10.9.2(@types/node@22.4.1)(typescript@5.5.4): + ts-node@10.9.2(@types/node@22.5.0)(typescript@5.5.4): dependencies: '@cspotcode/source-map-support': 0.8.1 '@tsconfig/node10': 1.0.11 '@tsconfig/node12': 1.0.11 '@tsconfig/node14': 1.0.3 '@tsconfig/node16': 1.0.4 - '@types/node': 22.4.1 + '@types/node': 22.5.0 acorn: 8.12.1 acorn-walk: 8.3.3 arg: 4.1.3 diff --git a/commands/bot/feedback.ts b/src/commands/bot/feedback.ts similarity index 100% rename from commands/bot/feedback.ts rename to src/commands/bot/feedback.ts diff --git a/commands/bot/ping.ts b/src/commands/bot/ping.ts similarity index 100% rename from commands/bot/ping.ts rename to src/commands/bot/ping.ts diff --git a/commands/bot/status.ts b/src/commands/bot/status.ts similarity index 100% rename from commands/bot/status.ts rename to src/commands/bot/status.ts diff --git a/commands/developer/backup.ts b/src/commands/developer/backup.ts similarity index 100% rename from commands/developer/backup.ts rename to src/commands/developer/backup.ts diff --git a/commands/developer/behave.ts b/src/commands/developer/behave.ts similarity index 100% rename from commands/developer/behave.ts rename to src/commands/developer/behave.ts diff --git a/commands/developer/eval.ts b/src/commands/developer/eval.ts similarity index 100% rename from commands/developer/eval.ts rename to src/commands/developer/eval.ts diff --git a/commands/developer/restart.ts b/src/commands/developer/restart.ts similarity index 100% rename from commands/developer/restart.ts rename to src/commands/developer/restart.ts diff --git a/commands/developer/say.ts b/src/commands/developer/say.ts similarity index 100% rename from commands/developer/say.ts rename to src/commands/developer/say.ts diff --git a/commands/developer/shutdown.ts b/src/commands/developer/shutdown.ts similarity index 100% rename from commands/developer/shutdown.ts rename to src/commands/developer/shutdown.ts diff --git a/commands/submission/autopush.ts b/src/commands/submission/autopush.ts similarity index 100% rename from commands/submission/autopush.ts rename to src/commands/submission/autopush.ts diff --git a/commands/submission/channelpush.ts b/src/commands/submission/channelpush.ts similarity index 100% rename from commands/submission/channelpush.ts rename to src/commands/submission/channelpush.ts diff --git a/events/buttonUsed.ts b/src/events/buttonUsed.ts similarity index 100% rename from events/buttonUsed.ts rename to src/events/buttonUsed.ts diff --git a/events/interactionCreate.ts b/src/events/interactionCreate.ts similarity index 100% rename from events/interactionCreate.ts rename to src/events/interactionCreate.ts diff --git a/events/messageCreate.ts b/src/events/messageCreate.ts similarity index 100% rename from events/messageCreate.ts rename to src/events/messageCreate.ts diff --git a/events/messageReactionAdd.ts b/src/events/messageReactionAdd.ts similarity index 100% rename from events/messageReactionAdd.ts rename to src/events/messageReactionAdd.ts diff --git a/events/modalSubmit.ts b/src/events/modalSubmit.ts similarity index 100% rename from events/modalSubmit.ts rename to src/events/modalSubmit.ts diff --git a/events/ready.ts b/src/events/ready.ts similarity index 100% rename from events/ready.ts rename to src/events/ready.ts diff --git a/events/slashCommandUsed.ts b/src/events/slashCommandUsed.ts similarity index 100% rename from events/slashCommandUsed.ts rename to src/events/slashCommandUsed.ts diff --git a/events/threadCreate.ts b/src/events/threadCreate.ts similarity index 100% rename from events/threadCreate.ts rename to src/events/threadCreate.ts diff --git a/functions/commandHandler.ts b/src/functions/commandHandler.ts similarity index 100% rename from functions/commandHandler.ts rename to src/functions/commandHandler.ts diff --git a/functions/feedback.ts b/src/functions/feedback.ts similarity index 100% rename from functions/feedback.ts rename to src/functions/feedback.ts diff --git a/functions/fetchSettings.ts b/src/functions/fetchSettings.ts similarity index 100% rename from functions/fetchSettings.ts rename to src/functions/fetchSettings.ts diff --git a/functions/handleError.ts b/src/functions/handleError.ts similarity index 100% rename from functions/handleError.ts rename to src/functions/handleError.ts diff --git a/functions/images/GIFEncoder.ts b/src/functions/images/GIFEncoder.ts similarity index 100% rename from functions/images/GIFEncoder.ts rename to src/functions/images/GIFEncoder.ts diff --git a/functions/images/animate.ts b/src/functions/images/animate.ts similarity index 100% rename from functions/images/animate.ts rename to src/functions/images/animate.ts diff --git a/functions/images/difference.ts b/src/functions/images/difference.ts similarity index 100% rename from functions/images/difference.ts rename to src/functions/images/difference.ts diff --git a/functions/images/magnify.ts b/src/functions/images/magnify.ts similarity index 100% rename from functions/images/magnify.ts rename to src/functions/images/magnify.ts diff --git a/functions/images/palette.ts b/src/functions/images/palette.ts similarity index 100% rename from functions/images/palette.ts rename to src/functions/images/palette.ts diff --git a/functions/images/stitch.ts b/src/functions/images/stitch.ts similarity index 100% rename from functions/images/stitch.ts rename to src/functions/images/stitch.ts diff --git a/functions/images/tile.ts b/src/functions/images/tile.ts similarity index 100% rename from functions/images/tile.ts rename to src/functions/images/tile.ts diff --git a/functions/pushToGitHub.ts b/src/functions/pushToGitHub.ts similarity index 100% rename from functions/pushToGitHub.ts rename to src/functions/pushToGitHub.ts diff --git a/functions/saveDB.ts b/src/functions/saveDB.ts similarity index 100% rename from functions/saveDB.ts rename to src/functions/saveDB.ts diff --git a/functions/submission/handleResults.ts b/src/functions/submission/handleResults.ts similarity index 96% rename from functions/submission/handleResults.ts rename to src/functions/submission/handleResults.ts index 4ff52938..95c8b8c5 100644 --- a/functions/submission/handleResults.ts +++ b/src/functions/submission/handleResults.ts @@ -9,6 +9,7 @@ import { mkdirSync, writeFile } from "fs"; import axios from "axios"; import type { Contribution, Pack, PackFile, Texture } from "@interfaces/database"; import { TextChannel, Client, Message } from "discord.js"; +import { join, sep } from "path"; export interface DownloadableMessage { url: string; @@ -127,12 +128,12 @@ export async function downloadTexture( for (const path of paths) { // write file to every version of a path for (const version of path.versions) { - const fullPath = `${baseFolder}/${packFolder}/${version}/${path.name}`; + const fullPath = join(baseFolder, packFolder, version, path.name); // trim last bit to get folder tree - mkdirSync(fullPath.slice(0, fullPath.lastIndexOf("/")), { recursive: true }); + mkdirSync(fullPath.slice(0, fullPath.lastIndexOf(sep)), { recursive: true }); - // better to use the callback version because .then and .catch are sent to the same output + // something is always being logged when debugging so the callback version is simpler writeFile(fullPath, imageFile, (err) => { if (DEBUG) return console.log(err ?? `Added texture to path: ${fullPath}`); }); diff --git a/functions/submission/makeEmbed.ts b/src/functions/submission/makeEmbed.ts similarity index 100% rename from functions/submission/makeEmbed.ts rename to src/functions/submission/makeEmbed.ts diff --git a/functions/submission/pushTextures.ts b/src/functions/submission/pushTextures.ts similarity index 95% rename from functions/submission/pushTextures.ts rename to src/functions/submission/pushTextures.ts index 60d46d77..62248a72 100644 --- a/functions/submission/pushTextures.ts +++ b/src/functions/submission/pushTextures.ts @@ -4,6 +4,7 @@ import formattedDate from "@helpers/formattedDate"; import pushToGitHub from "@functions/pushToGitHub"; import type { PackFile } from "@interfaces/database"; +import { join } from "path"; const DEBUG = process.env.DEBUG.toLowerCase() == "true"; /** @@ -30,7 +31,7 @@ export default async function pushTextures( continue; } for (const branch of settings.versions[edition]) { - const path = `${basePath}/${packGitHub.repo}/${branch}/`; + const path = join(basePath, packGitHub.repo, branch); // don't create empty commits if (!existsSync(path)) continue; diff --git a/functions/submission/reactionMenu.ts b/src/functions/submission/reactionMenu.ts similarity index 100% rename from functions/submission/reactionMenu.ts rename to src/functions/submission/reactionMenu.ts diff --git a/functions/submission/sendToChannel.ts b/src/functions/submission/sendToChannel.ts similarity index 100% rename from functions/submission/sendToChannel.ts rename to src/functions/submission/sendToChannel.ts diff --git a/functions/submission/submitTexture.ts b/src/functions/submission/submitTexture.ts similarity index 100% rename from functions/submission/submitTexture.ts rename to src/functions/submission/submitTexture.ts diff --git a/functions/submission/utility/cancelSubmission.ts b/src/functions/submission/utility/cancelSubmission.ts similarity index 100% rename from functions/submission/utility/cancelSubmission.ts rename to src/functions/submission/utility/cancelSubmission.ts diff --git a/functions/submission/utility/changeStatus.ts b/src/functions/submission/utility/changeStatus.ts similarity index 100% rename from functions/submission/utility/changeStatus.ts rename to src/functions/submission/utility/changeStatus.ts diff --git a/functions/submission/utility/choiceEmbed.ts b/src/functions/submission/utility/choiceEmbed.ts similarity index 100% rename from functions/submission/utility/choiceEmbed.ts rename to src/functions/submission/utility/choiceEmbed.ts diff --git a/functions/submission/utility/generateComparison.ts b/src/functions/submission/utility/generateComparison.ts similarity index 100% rename from functions/submission/utility/generateComparison.ts rename to src/functions/submission/utility/generateComparison.ts diff --git a/functions/submission/utility/getAuthors.ts b/src/functions/submission/utility/getAuthors.ts similarity index 100% rename from functions/submission/utility/getAuthors.ts rename to src/functions/submission/utility/getAuthors.ts diff --git a/functions/submission/utility/getPackByChannel.ts b/src/functions/submission/utility/getPackByChannel.ts similarity index 100% rename from functions/submission/utility/getPackByChannel.ts rename to src/functions/submission/utility/getPackByChannel.ts diff --git a/functions/submission/utility/instapass.ts b/src/functions/submission/utility/instapass.ts similarity index 100% rename from functions/submission/utility/instapass.ts rename to src/functions/submission/utility/instapass.ts diff --git a/functions/submission/utility/invalidate.ts b/src/functions/submission/utility/invalidate.ts similarity index 100% rename from functions/submission/utility/invalidate.ts rename to src/functions/submission/utility/invalidate.ts diff --git a/functions/submission/utility/retrieveSubmission.ts b/src/functions/submission/utility/retrieveSubmission.ts similarity index 100% rename from functions/submission/utility/retrieveSubmission.ts rename to src/functions/submission/utility/retrieveSubmission.ts diff --git a/helpers/addDeleteButton.ts b/src/helpers/addDeleteButton.ts similarity index 100% rename from helpers/addDeleteButton.ts rename to src/helpers/addDeleteButton.ts diff --git a/helpers/devLogger.ts b/src/helpers/devLogger.ts similarity index 100% rename from helpers/devLogger.ts rename to src/helpers/devLogger.ts diff --git a/helpers/formattedDate.ts b/src/helpers/formattedDate.ts similarity index 100% rename from helpers/formattedDate.ts rename to src/helpers/formattedDate.ts diff --git a/helpers/getImages.ts b/src/helpers/getImages.ts similarity index 100% rename from helpers/getImages.ts rename to src/helpers/getImages.ts diff --git a/helpers/getMessages.ts b/src/helpers/getMessages.ts similarity index 100% rename from helpers/getMessages.ts rename to src/helpers/getMessages.ts diff --git a/helpers/interactions.ts b/src/helpers/interactions.ts similarity index 100% rename from helpers/interactions.ts rename to src/helpers/interactions.ts diff --git a/helpers/minecraftSorter.ts b/src/helpers/minecraftSorter.ts similarity index 100% rename from helpers/minecraftSorter.ts rename to src/helpers/minecraftSorter.ts diff --git a/helpers/permissions.ts b/src/helpers/permissions.ts similarity index 100% rename from helpers/permissions.ts rename to src/helpers/permissions.ts diff --git a/helpers/walkSync.ts b/src/helpers/walkSync.ts similarity index 100% rename from helpers/walkSync.ts rename to src/helpers/walkSync.ts diff --git a/helpers/warnUser.ts b/src/helpers/warnUser.ts similarity index 100% rename from helpers/warnUser.ts rename to src/helpers/warnUser.ts diff --git a/index.ts b/src/index.ts similarity index 91% rename from index.ts rename to src/index.ts index 202313e5..dbe4dced 100644 --- a/index.ts +++ b/src/index.ts @@ -13,6 +13,7 @@ import { fetchSettings } from "@functions/fetchSettings"; import handleError from "@functions/handleError"; import { Client, GatewayIntentBits, Partials } from "discord.js"; import type { Event } from "@interfaces/discord"; +import { join } from "path"; export default function startBot() { const client = new Client({ @@ -47,9 +48,9 @@ export default function startBot() { * EVENT HANDLER * - see the ./events folder */ - const eventsFiles = readdirSync("./events").filter((f) => f.endsWith(".ts")); + const eventsFiles = readdirSync(join(__dirname, "events")).filter((f) => f.endsWith(".ts")); for (const file of eventsFiles) { - const event: Event = require(`./events/${file}`).default; + const event: Event = require(join(__dirname, "events", file)).default; // catch invalid events if (typeof event !== "object") continue; diff --git a/interfaces/database.ts b/src/interfaces/database.ts similarity index 100% rename from interfaces/database.ts rename to src/interfaces/database.ts diff --git a/interfaces/discord.ts b/src/interfaces/discord.ts similarity index 100% rename from interfaces/discord.ts rename to src/interfaces/discord.ts diff --git a/interfaces/images.ts b/src/interfaces/images.ts similarity index 100% rename from interfaces/images.ts rename to src/interfaces/images.ts diff --git a/tsconfig.json b/tsconfig.json index c763abb1..64e01ebd 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -6,7 +6,7 @@ "module": "commonjs", "moduleResolution": "node", "target": "ESNEXT", - "baseUrl": ".", + "baseUrl": "src", "paths": { "@functions/*": ["./functions/*"], "@helpers/*": ["./helpers/*"], @@ -15,7 +15,7 @@ "@submission/*": ["./functions/submission/*"], "@images/*": ["./functions/images/*"], "@interfaces/*": ["./interfaces/*"], - "@resources/*": ["./resources/*"], + "@resources/*": ["../resources/*"], "@index": ["./index.ts"], } }