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,7 +1,6 @@
import { onlineLogChannel, color } from "../../../../config/options.json"
import logToChannel from "../../../utils/functions/logtochannel"
import { Event } from "../../../interfaces"
import { ExtendedClient as Client } from "../../../utils/Client"
import { ChannelType } from "discord.js"
import { color } from "../../../../config/options.json"
export = {
name: "sendonlinemessage",
@@ -9,25 +8,12 @@ export = {
type: "event",
event: "ready",
execute(client: Client) {
execute() {
if (process.env.NODE_ENV === "dev") return
const channel = client.channels.cache.get(onlineLogChannel)
const embedColor = Number(color.replace("#", "0x"))
if (!channel) {
console.log(
"[ERROR] Could not find channel used for online message.",
)
return
}
if (channel.type !== ChannelType.GuildText) {
console.log("[ERROR] Online message channel is not a text channel.")
return
}
channel.send({
logToChannel("online", {
embeds: [
{
description: "Bot is online!",