Usded color log in event handlers

This commit is contained in:
2024-01-12 21:18:58 +01:00
parent 45762c19d6
commit 56f74e4e1b
5 changed files with 21 additions and 11 deletions

View File

@@ -2,6 +2,7 @@ import { ExtendedClient as Client } from "../Client"
import { color } from "../../../config/options.json"
import { Autocomplete } from "../../interfaces"
import { Events } from "discord.js"
import colorLog from "../functions/colors"
import path = require("path")
import fs = require("fs")
import logToChannel from "../functions/logtochannel"
@@ -31,9 +32,10 @@ export default function loadAutocompleteEvents(client: Client, ft: FileType) {
) {
client.autocomplete.set(autocomplete.name, autocomplete)
} else {
console.log(
console.log(colorLog(
`[WARNING] The autocomplete at ${filePath} is missing a required "name", "execute" or "type" property.`,
)
"red"
))
}
}

View File

@@ -1,4 +1,5 @@
import { ExtendedClient as Client } from "../Client"
import colorLog from "../functions/colors"
import { color } from "../../../config/options.json"
import { Button } from "../../interfaces"
import { Events } from "discord.js"
@@ -19,9 +20,10 @@ export default function loadButtonEvents(client: Client, ft: FileType) {
if ("name" in btn && "execute" in btn && btn.type === "button") {
client.buttons.set(btn.name, btn)
} else {
console.log(
console.log(colorLog(
`[WARNING] The button at ${filePath} is missing a required "name", "execute" or "type" property.`,
)
"red"
))
}
}

View File

@@ -1,4 +1,5 @@
import { ExtendedClient as Client } from "../Client"
import colorLog from "../functions/colors"
import { color } from "../../../config/options.json"
import { Command } from "../../interfaces"
import { Events } from "discord.js"
@@ -19,9 +20,10 @@ export default function loadSlashCommandsEvents(client: Client, ft: FileType) {
if ("data" in cmd && "execute" in cmd && cmd.type === "slash") {
client.commands.set(cmd.data.name, cmd)
} else {
console.log(
console.log(colorLog(
`[WARNING] The command at ${filePath} is missing a required "data", "execute" or "type" property.`,
)
"red"
))
}
}

View File

@@ -1,4 +1,5 @@
import { ExtendedClient as Client } from "../Client"
import colorLog from "../functions/colors"
import { ContextMenu } from "../../interfaces"
import { color } from "../../../config/options.json"
import { Events } from "discord.js"
@@ -26,9 +27,10 @@ export default function loadContextMenuEvents(client: Client, ft: FileType) {
if ("data" in cmd && "execute" in cmd && cmd.type === "contextmenu") {
client.contextmenus.set(cmd.data.name, cmd)
} else {
console.log(
console.log(colorLog(
`[WARNING] The command at ${filePath} is missing a required "data", "execute" or "type" property.`,
)
"red"
))
}
}

View File

@@ -1,7 +1,8 @@
import { ExtendedClient as Client } from "../Client"
import colorLog from "../functions/colors"
import { color } from "../../../config/options.json"
import { Modal } from "../../interfaces"
import { Events} from "discord.js"
import { Events } from "discord.js"
import path = require("path")
import fs = require("fs")
import logToChannel from "../functions/logtochannel"
@@ -21,9 +22,10 @@ export default function loadModalEvents(client: Client, ft: FileType) {
if ("name" in modal && "execute" in modal && modal.type === "modal") {
client.modals.set(modal.name, modal)
} else {
console.log(
console.log(colorLog(
`[WARNING] The modal at ${filePath} is missing a required "name", "execute" or "type" property.`,
)
"red"
))
}
}