Added logtochannel function and moved to it

This commit is contained in:
2024-01-07 00:04:07 +01:00
parent d06e15c96c
commit 8d55dff5c7
10 changed files with 58 additions and 106 deletions

View File

@@ -1,9 +1,10 @@
import { ExtendedClient as Client } from "../Client"
import { errorLogChannel, color } from "../../../config/options.json"
import { color } from "../../../config/options.json"
import { Command } from "../../interfaces"
import { Events, TextChannel } from "discord.js"
import { Events } from "discord.js"
import path = require("path")
import fs = require("fs")
import logToChannel from "../functions/logtochannel"
type FileType = "js" | "ts"
const embedColor = Number(color.replace("#", "0x"))
@@ -41,14 +42,7 @@ export default function loadSlashCommandsEvents(client: Client, ft: FileType) {
await command.execute(interaction, client)
} catch (error) {
if (process.env.NODE_ENV !== "dev") {
const channel = client.channels.cache.get(
errorLogChannel,
) as TextChannel
if (!channel) {
console.log("No error log channel found.")
}
await channel.send({
await logToChannel("error", {
embeds: [
{
title: "Command error occured",