😇 Untitled commit lol.
This commit is contained in:
@@ -5,7 +5,8 @@
|
|||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsc",
|
"build": "tsc",
|
||||||
"prepare": "ts-patch install -s"
|
"prepare": "ts-patch install -s",
|
||||||
|
"lint": "eslint"
|
||||||
},
|
},
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
"author": "",
|
"author": "",
|
||||||
|
|||||||
42
src/index.ts
42
src/index.ts
@@ -4,10 +4,7 @@ import path from "path";
|
|||||||
import pino, { transport } from "pino";
|
import pino, { transport } from "pino";
|
||||||
import { Sequelize } from "sequelize-typescript";
|
import { Sequelize } from "sequelize-typescript";
|
||||||
|
|
||||||
config({
|
// Setup logger
|
||||||
quiet:true
|
|
||||||
})
|
|
||||||
|
|
||||||
const logger = pino(transport({
|
const logger = pino(transport({
|
||||||
targets: [
|
targets: [
|
||||||
{
|
{
|
||||||
@@ -19,6 +16,27 @@ const logger = pino(transport({
|
|||||||
]
|
]
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
// Load env
|
||||||
|
const env = config({
|
||||||
|
quiet: true
|
||||||
|
})
|
||||||
|
if (env.error) {
|
||||||
|
logger.error(env.error)
|
||||||
|
} else {
|
||||||
|
logger.info(`🗃️ Load .env with ${Object.keys(env.parsed ?? {}).length} keys.`)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Database Setup
|
||||||
|
const sequelize = new Sequelize({
|
||||||
|
models: [path.join(__dirname + 'database/**/*.model.ts')],
|
||||||
|
dialect: "sqlite",
|
||||||
|
storage: "database.sqlite",
|
||||||
|
logging(sql) {
|
||||||
|
logger.info(sql)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
// Setup discord bot
|
||||||
const intents = new IntentsBitField()
|
const intents = new IntentsBitField()
|
||||||
.add(GatewayIntentBits.Guilds)
|
.add(GatewayIntentBits.Guilds)
|
||||||
.add(GatewayIntentBits.GuildMembers)
|
.add(GatewayIntentBits.GuildMembers)
|
||||||
@@ -31,19 +49,13 @@ const client = new Client({
|
|||||||
intents: intents
|
intents: intents
|
||||||
})
|
})
|
||||||
|
|
||||||
const sequelize = new Sequelize({
|
|
||||||
models: [path.join(__dirname + 'database/**/*.model.ts')],
|
|
||||||
dialect: "sqlite",
|
|
||||||
storage: "database.sqlite",
|
|
||||||
logging(sql, timing) {
|
|
||||||
logger.info(sql)
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
client.on(Events.Debug, (info) => logger.debug(info));
|
client.on(Events.Debug, (info) => logger.debug(info));
|
||||||
client.on(Events.Warn, (info) => logger.warn(info));
|
client.on(Events.Warn, (info) => logger.warn(info));
|
||||||
client.on(Events.Error, (error) => logger.error(error));
|
client.on(Events.Error, (error) => logger.error(error));
|
||||||
|
|
||||||
Promise.all([/*client.login(process.env.TOKEN),*/ sequelize.authenticate().then(()=>sequelize.sync({alter:true}))]).then(async () => {
|
// Start all (database and bot)
|
||||||
|
Promise.all([client.login(process.env.TOKEN), sequelize.authenticate().then(() => sequelize.sync({ alter: true }))]).then(async () => {
|
||||||
|
logger.info("🎉 Bot started Successfully !")
|
||||||
|
}, (error) => {
|
||||||
|
logger.fatal(error)
|
||||||
})
|
})
|
||||||
5
src/interactions/index.ts
Normal file
5
src/interactions/index.ts
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
import { Client } from "discord.js";
|
||||||
|
|
||||||
|
export default function registerInteraction(client: Client<true>) {
|
||||||
|
client.application
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user