🏷️ tsconfig-paths (absolute) instead of relative
This commit is contained in:
parent
12b970b23e
commit
b44d093919
8 changed files with 195 additions and 174 deletions
6
.gitignore
vendored
6
.gitignore
vendored
|
@ -4,6 +4,12 @@ node_modules
|
|||
config.json
|
||||
package-lock.json
|
||||
|
||||
|
||||
**/config/*.ts
|
||||
!**/config/index.ts
|
||||
!**/config/example.*.ts
|
||||
|
||||
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
|
|
|
@ -39,12 +39,14 @@
|
|||
"discord.js": "^13.6.0",
|
||||
"dotenv": "^16.0.0",
|
||||
"i18next": "^21.6.13",
|
||||
"module-alias": "^2.2.2",
|
||||
"mongoose": "^6.2.3",
|
||||
"node-schedule": "^2.1.0",
|
||||
"pino": "^7.0.0-rc.9",
|
||||
"pino-pretty": "^7.6.1",
|
||||
"quick.db": "^7.1.3",
|
||||
"ts-node": "^10.7.0",
|
||||
"tsconfig-paths": "^3.14.1",
|
||||
"typescript": "^4.6.3",
|
||||
"uuid": "^8.3.2",
|
||||
"winston-daily-rotate-file": "^4.6.1"
|
||||
|
|
2
src/config/example.database.ts
Normal file
2
src/config/example.database.ts
Normal file
|
@ -0,0 +1,2 @@
|
|||
export const url =
|
||||
"mongodb+srv://username:password@server/database?retryWrites=true&w=majority";
|
|
@ -1,11 +1,11 @@
|
|||
import mongoose from "mongoose";
|
||||
import { url } from "@config/database";
|
||||
|
||||
import { mongodb } from "../../config.json";
|
||||
import logger from "../logger";
|
||||
import mongoose from "mongoose";
|
||||
import logger from "@logger";
|
||||
|
||||
export default async () => {
|
||||
await mongoose
|
||||
.connect(mongodb?.url)
|
||||
.connect(url)
|
||||
?.then(async () => {
|
||||
logger.info("Successfully connected to MongoDB!");
|
||||
})
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
// Dependencies
|
||||
import { Client, Intents } from "discord.js"; // discord.js
|
||||
import "tsconfig-paths/register";
|
||||
|
||||
// Configurations
|
||||
import { bot } from "../config.json";
|
||||
|
||||
import database from "./database";
|
||||
import database from "@root/database";
|
||||
import schedules from "./schedules";
|
||||
|
||||
// Handlers
|
||||
|
|
|
@ -7,22 +7,22 @@ export default {
|
|||
data: (command: SlashCommandSubcommandBuilder) => {
|
||||
return command
|
||||
.setName("view")
|
||||
.setDescription("View a counter.")
|
||||
.setDescription("View a counter's count.")
|
||||
.addChannelOption((option) =>
|
||||
option
|
||||
.setName("channel")
|
||||
.setDescription("The counter channel you want to view")
|
||||
.setDescription("The counter channel you want to view.")
|
||||
.setRequired(true)
|
||||
.addChannelType(ChannelType.GuildText as number)
|
||||
);
|
||||
},
|
||||
execute: async (interaction: CommandInteraction, tools: any) => {
|
||||
const { options, guild } = interaction;
|
||||
const { colors, footer } = tools.config;
|
||||
const { config, schemas } = tools;
|
||||
|
||||
const discordChannel = options?.getChannel("channel");
|
||||
|
||||
const counter = await tools.schemas.counter?.findOne({
|
||||
const counter = await schemas?.counter?.findOne({
|
||||
guildId: guild?.id,
|
||||
channelId: discordChannel?.id,
|
||||
});
|
||||
|
@ -34,8 +34,11 @@ export default {
|
|||
.setTitle("[:1234:] Counters (View)")
|
||||
.setDescription(`${discordChannel} is not a counting channel!`)
|
||||
.setTimestamp(new Date())
|
||||
.setColor(colors?.error as ColorResolvable)
|
||||
.setFooter({ text: footer?.text, iconURL: footer?.icon }),
|
||||
.setColor(config?.colors?.error as ColorResolvable)
|
||||
.setFooter({
|
||||
text: config?.footer?.text,
|
||||
iconURL: config?.footer?.icon,
|
||||
}),
|
||||
],
|
||||
});
|
||||
}
|
||||
|
@ -48,8 +51,11 @@ export default {
|
|||
`${discordChannel} is currently at number ${counter?.counter}.`
|
||||
)
|
||||
.setTimestamp(new Date())
|
||||
.setColor(colors?.success as ColorResolvable)
|
||||
.setFooter({ text: footer?.text, iconURL: footer?.icon }),
|
||||
.setColor(config?.colors?.success as ColorResolvable)
|
||||
.setFooter({
|
||||
text: config?.footer?.text,
|
||||
iconURL: config?.footer?.icon,
|
||||
}),
|
||||
],
|
||||
});
|
||||
},
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import helpers from "../helpers";
|
||||
import helpers from "@root/helpers";
|
||||
import config from "../../config.json";
|
||||
import schemas from "../database/schemas";
|
||||
|
||||
|
|
|
@ -14,11 +14,15 @@
|
|||
"isolatedModules": true,
|
||||
// "removeComments": true,
|
||||
"outDir": "./build",
|
||||
"baseUrl": "./src",
|
||||
"typeRoots": ["/types/common", "./node_modules/@types"],
|
||||
"paths": {
|
||||
"@interface/*": ["./src/Interfaces/*"]
|
||||
},
|
||||
"typeRoots": ["./src/types/common", "./node_modules/@types"]
|
||||
"@interface/*": ["Interfaces/*"],
|
||||
"@root/*": ["*"],
|
||||
"@config/*": ["config/*"],
|
||||
"@logger": ["logger"]
|
||||
}
|
||||
},
|
||||
"exclude": ["./node_modules", "./test"],
|
||||
"include": ["./src"]
|
||||
"include": ["./src"],
|
||||
"exclude": ["./node_modules", "./test"]
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue