Converted main codebase to typescript

Signed-off-by: Taken <taken@mairimashita.org>
This commit is contained in:
2023-12-28 13:17:57 +01:00
parent 1d9ded82a4
commit 68fde04bbb
122 changed files with 14230 additions and 1834 deletions

46
src/index.ts Normal file
View File

@@ -0,0 +1,46 @@
import { ExtendedClient as Client} from "./utils/Client"
import { GatewayIntentBits, Partials } from "discord.js"
import config from "./utils/Config"
import { redis } from "./utils/Redis"
import { connect } from "mongoose"
import { loadAllEvents } from "./utils/Events"
import { autoDeployCommands } from "./utils/Autodeploy"
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.MessageContent,
GatewayIntentBits.DirectMessages,
GatewayIntentBits.GuildVoiceStates
],
partials: [
Partials.GuildMember,
Partials.User,
Partials.Message,
Partials.Channel
]
})
loadAllEvents(client)
let token: string
if (process.env.NODE_ENV === "dev") {
console.log("Running in development mode.")
token = config.dev.devtoken
autoDeployCommands()
} else {
console.log("Running in production mode.")
token = config.prod.token
}
client.login(token)
redis.on("ready", () => {
console.log("Connected to Redis")
})
connect(config.prod.mongoURI, {}).then(() => {
console.log("Connected to MongoDB")
})