51 lines
1.8 KiB
TypeScript
51 lines
1.8 KiB
TypeScript
import { Client, Collection, GatewayIntentBits, Partials } from "discord.js"
|
|
import color from "./functions/colors"
|
|
import { Command, ContextMenu, Button, Modal, Autocomplete } from "interfaces"
|
|
import env from "./Env"
|
|
import autoDeployCommands from "./Autodeploy"
|
|
|
|
export class ExtendedClient extends Client {
|
|
commands: Collection<string, Command> = new Collection()
|
|
contextmenus: Collection<string, ContextMenu> = new Collection()
|
|
buttons: Collection<string, Button> = new Collection()
|
|
modals: Collection<string, Modal> = new Collection()
|
|
autocomplete: Collection<string, Autocomplete> = new Collection()
|
|
|
|
constructor() {
|
|
super({
|
|
intents: [
|
|
GatewayIntentBits.Guilds,
|
|
GatewayIntentBits.GuildMessages,
|
|
GatewayIntentBits.GuildMembers,
|
|
GatewayIntentBits.MessageContent,
|
|
GatewayIntentBits.DirectMessages,
|
|
GatewayIntentBits.GuildVoiceStates
|
|
],
|
|
partials: [
|
|
Partials.GuildMember,
|
|
Partials.User,
|
|
Partials.Message,
|
|
Partials.Channel
|
|
]
|
|
})
|
|
}
|
|
|
|
async start() {
|
|
let token: string
|
|
if (process.env.NODE_ENV === "dev" && process.env.TYPESCRIPT) {
|
|
console.log(color("Running in development mode. [ts-node]", "lavender"))
|
|
token = env.dev.devtoken!
|
|
autoDeployCommands("ts", this)
|
|
} else if (process.env.NODE_ENV === "dev" && !process.env.TYPESCRIPT) {
|
|
console.log(color("Running in development mode.", "lavender"))
|
|
token = env.dev.devtoken!
|
|
autoDeployCommands("js", this)
|
|
} else {
|
|
console.log(color("Running in production mode.", "green"))
|
|
token = env.prod.token!
|
|
}
|
|
|
|
this.login(token)
|
|
}
|
|
}
|