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