Updated dir structure
This commit is contained in:
@@ -2,7 +2,7 @@ import { GuildMember, SlashCommandBuilder } from "discord.js"
|
|||||||
import snipeCacheSchema from "schemas/snipeCacheSchema"
|
import snipeCacheSchema from "schemas/snipeCacheSchema"
|
||||||
import { Command } from "interfaces"
|
import { Command } from "interfaces"
|
||||||
import { color } from "config/options.json"
|
import { color } from "config/options.json"
|
||||||
import { SnipeCache } from "utils/Types"
|
import { SnipeCache } from "typings"
|
||||||
|
|
||||||
export = {
|
export = {
|
||||||
name: "snipe",
|
name: "snipe",
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { ChannelType, Message } from "discord.js"
|
|||||||
import { Event } from "interfaces"
|
import { Event } from "interfaces"
|
||||||
import snipeCacheSchema from "schemas/snipeCacheSchema"
|
import snipeCacheSchema from "schemas/snipeCacheSchema"
|
||||||
import mongoose from "mongoose"
|
import mongoose from "mongoose"
|
||||||
import { SnipeCache } from "utils/Types"
|
import { SnipeCache } from "typings"
|
||||||
|
|
||||||
export = {
|
export = {
|
||||||
name: "snipecache",
|
name: "snipecache",
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
export type SnipeCache = {
|
type SnipeCache = {
|
||||||
author: string
|
author: string
|
||||||
content: string
|
content: string
|
||||||
channel: string
|
channel: string
|
||||||
createdAt: number
|
createdAt: number
|
||||||
deletedAt: number
|
deletedAt: number
|
||||||
attachments: string[]
|
attachments: string[]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default SnipeCache
|
||||||
3
src/typings/index.ts
Normal file
3
src/typings/index.ts
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
import SnipeCache from "./Types"
|
||||||
|
|
||||||
|
export { SnipeCache }
|
||||||
@@ -1,10 +1,6 @@
|
|||||||
import { Client, Collection, GatewayIntentBits, Partials } from "discord.js"
|
import { Client, Collection, GatewayIntentBits, Partials } from "discord.js"
|
||||||
import color from "./functions/colors"
|
import color from "./functions/colors"
|
||||||
import { Command } from "interfaces"
|
import { Command, ContextMenu, Button, Modal, Autocomplete } from "interfaces"
|
||||||
import { ContextMenu } from "interfaces"
|
|
||||||
import { Button } from "interfaces"
|
|
||||||
import { Modal } from "interfaces"
|
|
||||||
import { Autocomplete } from "interfaces"
|
|
||||||
import env from "./Env"
|
import env from "./Env"
|
||||||
import autoDeployCommands from "./Autodeploy"
|
import autoDeployCommands from "./Autodeploy"
|
||||||
import { loadAllEvents } from "./Events"
|
import { loadAllEvents } from "./Events"
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
import { ExtendedClient as Client } from "./Client"
|
|
||||||
import { loadButtonEvents } from "./eventHandlers"
|
|
||||||
import { loadSlashCommandsEvents } from "./eventHandlers"
|
|
||||||
import { loadContextMenuEvents } from "./eventHandlers"
|
|
||||||
import { loadModalEvents } from "./eventHandlers"
|
|
||||||
import { loadEvents } from "./eventHandlers"
|
|
||||||
import { loadAutocompleteEvents } from "./eventHandlers"
|
|
||||||
type FileType = "js" | "ts"
|
|
||||||
|
|
||||||
export function loadAllEvents(client: Client, ft: FileType) {
|
|
||||||
loadEvents(client)
|
|
||||||
loadButtonEvents(client, ft)
|
|
||||||
loadSlashCommandsEvents(client, ft)
|
|
||||||
loadContextMenuEvents(client, ft)
|
|
||||||
loadModalEvents(client, ft)
|
|
||||||
loadAutocompleteEvents(client, ft)
|
|
||||||
}
|
|
||||||
19
src/utils/Events/index.ts
Normal file
19
src/utils/Events/index.ts
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
import { ExtendedClient as Client } from "../Client"
|
||||||
|
import loadAutocompleteEvents from "./autocomplete"
|
||||||
|
import loadButtonEvents from "./button"
|
||||||
|
import loadSlashCommandsEvents from "./command"
|
||||||
|
import loadContextMenuEvents from "./contextmenu"
|
||||||
|
import loadCronEvents from "./cron"
|
||||||
|
import loadEvents from "./events"
|
||||||
|
import loadModalEvents from "./modal"
|
||||||
|
type FileType = "js" | "ts"
|
||||||
|
|
||||||
|
export function loadAllEvents(client: Client, ft: FileType) {
|
||||||
|
loadEvents(client)
|
||||||
|
loadButtonEvents(client, ft)
|
||||||
|
loadSlashCommandsEvents(client, ft)
|
||||||
|
loadContextMenuEvents(client, ft)
|
||||||
|
loadModalEvents(client, ft)
|
||||||
|
loadAutocompleteEvents(client, ft)
|
||||||
|
loadCronEvents()
|
||||||
|
}
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
export { skywarsLevel } from "./functions/skywars"
|
|
||||||
export { bedwarsLevel } from "./functions/bedwars"
|
|
||||||
export { hypixelLevel } from "./functions/hypixel"
|
|
||||||
export { formatUuid } from "./functions/uuid"
|
|
||||||
export { guildLevel, scaledGEXP } from "./functions/guild"
|
|
||||||
export {
|
|
||||||
getUUID,
|
|
||||||
getIGN,
|
|
||||||
getPlayer,
|
|
||||||
getGuild,
|
|
||||||
getHeadURL,
|
|
||||||
} from "./functions/account"
|
|
||||||
12
src/utils/Hypixel/index.ts
Normal file
12
src/utils/Hypixel/index.ts
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
export { skywarsLevel } from "./skywars"
|
||||||
|
export { bedwarsLevel } from "./bedwars"
|
||||||
|
export { hypixelLevel } from "./hypixel"
|
||||||
|
export { formatUuid } from "./uuid"
|
||||||
|
export { guildLevel, scaledGEXP } from "./guild"
|
||||||
|
export {
|
||||||
|
getUUID,
|
||||||
|
getIGN,
|
||||||
|
getPlayer,
|
||||||
|
getGuild,
|
||||||
|
getHeadURL,
|
||||||
|
} from "./account"
|
||||||
@@ -3,16 +3,13 @@ import color from "utils/functions/colors"
|
|||||||
import { Redis } from "ioredis"
|
import { Redis } from "ioredis"
|
||||||
import env from "utils/Env"
|
import env from "utils/Env"
|
||||||
import { connect } from "mongoose"
|
import { connect } from "mongoose"
|
||||||
import init from "utils/Init"
|
|
||||||
import { loadCronEvents } from "utils/eventHandlers"
|
|
||||||
const client = new Client()
|
const client = new Client()
|
||||||
const redis = new Redis(env.prod.redisURI!)
|
const redis = new Redis(env.prod.redisURI!)
|
||||||
|
|
||||||
class Bot {
|
class Bot {
|
||||||
async start() {
|
async start() {
|
||||||
init()
|
this.init()
|
||||||
client.start()
|
client.start()
|
||||||
loadCronEvents()
|
|
||||||
redis.on("ready", () => {
|
redis.on("ready", () => {
|
||||||
console.log(color("Connected to Redis", "green"))
|
console.log(color("Connected to Redis", "green"))
|
||||||
})
|
})
|
||||||
@@ -20,6 +17,24 @@ class Bot {
|
|||||||
console.log(color("Connected to MongoDB", "green"))
|
console.log(color("Connected to MongoDB", "green"))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async init() {
|
||||||
|
const prodValues = env.prod
|
||||||
|
const devValues = env.dev
|
||||||
|
|
||||||
|
if (process.env.NODE_ENV === "dev") {
|
||||||
|
for (const [key, value] of Object.entries(devValues)) {
|
||||||
|
if (!value) throw new Error(`No ${key} specified`)
|
||||||
|
}
|
||||||
|
for (const [key, value] of Object.entries(prodValues)) {
|
||||||
|
if (!value) throw new Error(`No ${key} specified`)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (const [key, value] of Object.entries(prodValues)) {
|
||||||
|
if (!value) throw new Error(`No ${key} specified`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default { Bot, client, redis }
|
export default { Bot, client, redis }
|
||||||
|
|||||||
@@ -1,20 +0,0 @@
|
|||||||
import env from "utils/Env"
|
|
||||||
|
|
||||||
const prodValues = env.prod
|
|
||||||
const devValues = env.dev
|
|
||||||
|
|
||||||
export default function init() {
|
|
||||||
if (process.env.NODE_ENV === "dev") {
|
|
||||||
for (const [key, value] of Object.entries(devValues)) {
|
|
||||||
if (!value) throw new Error(`No ${key} specified`)
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const [key, value] of Object.entries(prodValues)) {
|
|
||||||
if (!value) throw new Error(`No ${key} specified`)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for (const [key, value] of Object.entries(prodValues)) {
|
|
||||||
if (!value) throw new Error(`No ${key} specified`)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
import loadAutocompleteEvents from "./autocomplete"
|
|
||||||
import loadButtonEvents from "./button"
|
|
||||||
import loadSlashCommandsEvents from "./command"
|
|
||||||
import loadContextMenuEvents from "./contextmenu"
|
|
||||||
import loadCronEvents from "./cron"
|
|
||||||
import loadEvents from "./events"
|
|
||||||
import loadModalEvents from "./modal"
|
|
||||||
|
|
||||||
export {
|
|
||||||
loadAutocompleteEvents,
|
|
||||||
loadButtonEvents,
|
|
||||||
loadSlashCommandsEvents,
|
|
||||||
loadContextMenuEvents,
|
|
||||||
loadCronEvents,
|
|
||||||
loadEvents,
|
|
||||||
loadModalEvents,
|
|
||||||
}
|
|
||||||
@@ -15,9 +15,10 @@
|
|||||||
"baseUrl": ".",
|
"baseUrl": ".",
|
||||||
"paths": {
|
"paths": {
|
||||||
"utils/*": ["src/utils/*"],
|
"utils/*": ["src/utils/*"],
|
||||||
"interfaces": ["src/interfaces/index"],
|
|
||||||
"schemas/*": ["src/schemas/*"],
|
"schemas/*": ["src/schemas/*"],
|
||||||
"config/*": ["src/config/*"],
|
"config/*": ["src/config/*"],
|
||||||
|
"interfaces": ["src/interfaces/index"],
|
||||||
|
"typings": ["src/typings/index"],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"include": ["src"],
|
"include": ["src"],
|
||||||
|
|||||||
Reference in New Issue
Block a user