Updated imports and formating
Signed-off-by: Taken <taken@mairimashita.org>
This commit is contained in:
@@ -3,8 +3,8 @@ import { color } from "config/options.json"
|
||||
import { Autocomplete } from "interfaces"
|
||||
import { Events } from "discord.js"
|
||||
import colorLog from "utils/functions/colors"
|
||||
import path = require("path")
|
||||
import fs = require("fs")
|
||||
import path from "path"
|
||||
import fs from "fs"
|
||||
import logToChannel from "utils/functions/logtochannel"
|
||||
type FileType = "js" | "ts"
|
||||
const embedColor = Number(color.replace("#", "0x"))
|
||||
@@ -32,10 +32,12 @@ export default function loadAutocompleteEvents(client: Client, ft: FileType) {
|
||||
) {
|
||||
client.autocomplete.set(autocomplete.name, autocomplete)
|
||||
} else {
|
||||
console.log(colorLog(
|
||||
`[WARNING] The autocomplete at ${filePath} is missing a required "name", "execute" or "type" property.`,
|
||||
"red"
|
||||
))
|
||||
console.log(
|
||||
colorLog(
|
||||
`[WARNING] The autocomplete at ${filePath} is missing a required "name", "execute" or "type" property.`,
|
||||
"red",
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +57,6 @@ export default function loadAutocompleteEvents(client: Client, ft: FileType) {
|
||||
await autocomplete.execute(interaction)
|
||||
} catch (error) {
|
||||
if (process.env.NODE_ENV !== "dev") {
|
||||
|
||||
await logToChannel("error", {
|
||||
embeds: [
|
||||
{
|
||||
@@ -63,7 +64,8 @@ export default function loadAutocompleteEvents(client: Client, ft: FileType) {
|
||||
description: String(error),
|
||||
color: embedColor,
|
||||
footer: {
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
icon_url:
|
||||
interaction.guild!.iconURL() || undefined,
|
||||
text:
|
||||
interaction.user.username +
|
||||
" | " +
|
||||
|
||||
@@ -3,8 +3,8 @@ import colorLog from "utils/functions/colors"
|
||||
import { color } from "config/options.json"
|
||||
import { Button } from "interfaces"
|
||||
import { Events } from "discord.js"
|
||||
import path = require("path")
|
||||
import fs = require("fs")
|
||||
import path from "path"
|
||||
import fs from "fs"
|
||||
import logToChannel from "utils/functions/logtochannel"
|
||||
type FileType = "js" | "ts"
|
||||
const embedColor = Number(color.replace("#", "0x"))
|
||||
@@ -20,10 +20,12 @@ 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(colorLog(
|
||||
`[WARNING] The button at ${filePath} is missing a required "name", "execute" or "type" property.`,
|
||||
"red"
|
||||
))
|
||||
console.log(
|
||||
colorLog(
|
||||
`[WARNING] The button at ${filePath} is missing a required "name", "execute" or "type" property.`,
|
||||
"red",
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +52,8 @@ export default function loadButtonEvents(client: Client, ft: FileType) {
|
||||
description: "```" + error + "```",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
icon_url:
|
||||
interaction.guild!.iconURL() || undefined,
|
||||
text:
|
||||
interaction.user.username +
|
||||
" | " +
|
||||
@@ -64,18 +67,24 @@ export default function loadButtonEvents(client: Client, ft: FileType) {
|
||||
console.error(error)
|
||||
if (!interaction.deferred) {
|
||||
await interaction.reply({
|
||||
embeds: [{
|
||||
description: "There was an error while executing this button!",
|
||||
color: embedColor,
|
||||
}],
|
||||
embeds: [
|
||||
{
|
||||
description:
|
||||
"There was an error while executing this button!",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
ephemeral: true,
|
||||
})
|
||||
} else {
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
description: "There was an error while executing this button! 2",
|
||||
color: embedColor,
|
||||
}]
|
||||
embeds: [
|
||||
{
|
||||
description:
|
||||
"There was an error while executing this button! 2",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,8 @@ import colorLog from "utils/functions/colors"
|
||||
import { color } from "config/options.json"
|
||||
import { Command } from "interfaces"
|
||||
import { Events } from "discord.js"
|
||||
import path = require("path")
|
||||
import fs = require("fs")
|
||||
import path from "path"
|
||||
import fs from "fs"
|
||||
import logToChannel from "utils/functions/logtochannel"
|
||||
type FileType = "js" | "ts"
|
||||
const embedColor = Number(color.replace("#", "0x"))
|
||||
@@ -20,10 +20,12 @@ 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(colorLog(
|
||||
`[WARNING] The command at ${filePath} is missing a required "data", "execute" or "type" property.`,
|
||||
"red"
|
||||
))
|
||||
console.log(
|
||||
colorLog(
|
||||
`[WARNING] The command at ${filePath} is missing a required "data", "execute" or "type" property.`,
|
||||
"red",
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +53,8 @@ export default function loadSlashCommandsEvents(client: Client, ft: FileType) {
|
||||
description: "```" + error + "```",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
icon_url:
|
||||
interaction.guild!.iconURL() || undefined,
|
||||
text:
|
||||
interaction.user.username +
|
||||
" | " +
|
||||
@@ -65,18 +68,24 @@ export default function loadSlashCommandsEvents(client: Client, ft: FileType) {
|
||||
console.error(error)
|
||||
if (!interaction.deferred) {
|
||||
await interaction.reply({
|
||||
embeds: [{
|
||||
description: "There was an error while executing this command!",
|
||||
color: embedColor,
|
||||
}],
|
||||
embeds: [
|
||||
{
|
||||
description:
|
||||
"There was an error while executing this command!",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
ephemeral: true,
|
||||
})
|
||||
} else {
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
description: "There was an error while executing this command!",
|
||||
color: embedColor,
|
||||
}]
|
||||
embeds: [
|
||||
{
|
||||
description:
|
||||
"There was an error while executing this command!",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,8 @@ import colorLog from "utils/functions/colors"
|
||||
import { ContextMenu } from "interfaces"
|
||||
import { color } from "config/options.json"
|
||||
import { Events } from "discord.js"
|
||||
import path = require("path")
|
||||
import fs = require("fs")
|
||||
import path from "path"
|
||||
import fs from "fs"
|
||||
import logToChannel from "utils/functions/logtochannel"
|
||||
type FileType = "js" | "ts"
|
||||
const embedColor = Number(color.replace("#", "0x"))
|
||||
@@ -27,10 +27,12 @@ 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(colorLog(
|
||||
`[WARNING] The command at ${filePath} is missing a required "data", "execute" or "type" property.`,
|
||||
"red"
|
||||
))
|
||||
console.log(
|
||||
colorLog(
|
||||
`[WARNING] The command at ${filePath} is missing a required "data", "execute" or "type" property.`,
|
||||
"red",
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +60,8 @@ export default function loadContextMenuEvents(client: Client, ft: FileType) {
|
||||
description: "```" + error + "```",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
icon_url:
|
||||
interaction.guild!.iconURL() || undefined,
|
||||
text:
|
||||
interaction.user.username +
|
||||
" | " +
|
||||
@@ -72,18 +75,24 @@ export default function loadContextMenuEvents(client: Client, ft: FileType) {
|
||||
console.error(error)
|
||||
if (!interaction.deferred) {
|
||||
await interaction.reply({
|
||||
embeds: [{
|
||||
description: "There was an error while executing this contextmenu command!",
|
||||
color: embedColor,
|
||||
}],
|
||||
embeds: [
|
||||
{
|
||||
description:
|
||||
"There was an error while executing this contextmenu command!",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
ephemeral: true,
|
||||
})
|
||||
} else {
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
description: "There was an error while executing this contextmenu command!",
|
||||
color: embedColor,
|
||||
}]
|
||||
embeds: [
|
||||
{
|
||||
description:
|
||||
"There was an error while executing this contextmenu command!",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { ExtendedClient as Client } from "utils/Client"
|
||||
import { Event } from "interfaces"
|
||||
import path = require("path")
|
||||
import fs = require("fs")
|
||||
import path from "path"
|
||||
import fs from "fs"
|
||||
|
||||
export default function loadEvents(client: Client) {
|
||||
const serverDir = path.join(__dirname, "..", "..", "events", "server")
|
||||
|
||||
@@ -3,8 +3,8 @@ import colorLog from "utils/functions/colors"
|
||||
import { color } from "config/options.json"
|
||||
import { Modal } from "interfaces"
|
||||
import { Events } from "discord.js"
|
||||
import path = require("path")
|
||||
import fs = require("fs")
|
||||
import path from "path"
|
||||
import fs from "fs"
|
||||
import logToChannel from "utils/functions/logtochannel"
|
||||
type FileType = "js" | "ts"
|
||||
const embedColor = Number(color.replace("#", "0x"))
|
||||
@@ -22,10 +22,12 @@ 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(colorLog(
|
||||
`[WARNING] The modal at ${filePath} is missing a required "name", "execute" or "type" property.`,
|
||||
"red"
|
||||
))
|
||||
console.log(
|
||||
colorLog(
|
||||
`[WARNING] The modal at ${filePath} is missing a required "name", "execute" or "type" property.`,
|
||||
"red",
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +54,8 @@ export default function loadModalEvents(client: Client, ft: FileType) {
|
||||
description: "```" + error + "```",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
icon_url:
|
||||
interaction.guild!.iconURL() || undefined,
|
||||
text:
|
||||
interaction.user.username +
|
||||
" | " +
|
||||
@@ -66,19 +69,25 @@ export default function loadModalEvents(client: Client, ft: FileType) {
|
||||
console.error(error)
|
||||
if (!interaction.deferred) {
|
||||
await interaction.reply({
|
||||
embeds: [{
|
||||
description: "There was an error while executing this modal!",
|
||||
color: embedColor
|
||||
}]
|
||||
embeds: [
|
||||
{
|
||||
description:
|
||||
"There was an error while executing this modal!",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
})
|
||||
} else {
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
description: "There was an error while executing this modal!",
|
||||
color: embedColor
|
||||
}]
|
||||
embeds: [
|
||||
{
|
||||
description:
|
||||
"There was an error while executing this modal!",
|
||||
color: embedColor,
|
||||
},
|
||||
],
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user