Moved code to src folder

This commit is contained in:
2023-11-23 12:38:55 +01:00
parent 932bce6057
commit 0eeb48b2dd
68 changed files with 59 additions and 70 deletions

49
src/index.js Normal file
View File

@@ -0,0 +1,49 @@
const { Client, GatewayIntentBits, Partials, Collection } = require("discord.js")
const { loadSlashCommandsEvents, loadContextMenuEvents, loadModalEvents, loadButtonEvents, loadEvents } = require("./utils/eventHandler.js")
const { autoDeployCommands } = require("./utils/autodeploy.js")
require("dotenv").config()
const mongoURI = process.env.MONGOURI
const { connect } = require("mongoose")
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
]
})
client.commands = new Collection()
client.events = new Collection()
client.modals = new Collection()
loadSlashCommandsEvents(client)
loadContextMenuEvents(client)
loadButtonEvents(client)
loadModalEvents(client)
loadEvents(client)
let token = ""
if (process.env.NODE_ENV === "dev") {
console.log("Running in development mode.")
token = process.env.DEVTOKEN
autoDeployCommands()
} else {
console.log("Running in production mode.")
token = process.env.PRODTOKEN
}
client.login(token)
connect(mongoURI, {}).then(() => {
console.log("Connected to MongoDB")
})