diff --git a/src/events/cron/weeklyGexp.ts b/src/events/cron/weeklyGexp.ts index b8df0d3..ad25f16 100644 --- a/src/events/cron/weeklyGexp.ts +++ b/src/events/cron/weeklyGexp.ts @@ -4,6 +4,7 @@ import { color, devMessage, } from "../../../config/options.json" +import colorLog from "../../utils/functions/colors" import { getGuild, getIGN } from "../../utils/Hypixel" import { Cron, GuildData } from "../../interfaces" import Illegitimate from "../../utils/Illegitimate" @@ -16,7 +17,7 @@ async function guildWeekly() { ) as TextChannel if (!channel) { - console.log("Guild log channel not found") + console.log(colorLog("Guild log channel not found", "red")) return } diff --git a/src/events/server/interactions/logBtnsCmds.ts b/src/events/server/interactions/logBtnsCmds.ts index 9acc705..7b385e2 100644 --- a/src/events/server/interactions/logBtnsCmds.ts +++ b/src/events/server/interactions/logBtnsCmds.ts @@ -1,4 +1,5 @@ import { ChatInputCommandInteraction, ButtonInteraction } from "discord.js" +import color from "../../../utils/functions/colors" import { Event } from "../../../interfaces" export = { @@ -10,29 +11,32 @@ export = { execute(interaction: ChatInputCommandInteraction | ButtonInteraction) { if (interaction.isCommand()) { try { - console.log( + console.log(color( interaction.user.username + " ran " + interaction.commandName + " " + interaction.options.getSubcommand(), + "pink") ) } catch { - console.log( + console.log(color( interaction.user.username + " ran " + interaction.commandName, + "pink") ) } } if (interaction.isButton()) { - console.log( + console.log(color( interaction.user.username + "#" + interaction.user.discriminator + " clicked " + interaction.customId, + "pink") ) return } diff --git a/src/events/server/ready/consolelog.ts b/src/events/server/ready/consolelog.ts index 6486b78..9759050 100644 --- a/src/events/server/ready/consolelog.ts +++ b/src/events/server/ready/consolelog.ts @@ -1,5 +1,6 @@ import { Event } from "../../../interfaces" import { ExtendedClient as Client } from "../../../utils/Client" +import color from "../../../utils/functions/colors" export = { name: "conolelog", @@ -8,6 +9,6 @@ export = { event: "ready", execute(client: Client) { - console.log("Logged in as " + client.user!.tag + "!") + console.log(color("Logged in as " + client.user!.tag + "!", "green")) }, } as Event diff --git a/src/utils/Autodeploy.ts b/src/utils/Autodeploy.ts index 3c2b8a3..b7eec34 100644 --- a/src/utils/Autodeploy.ts +++ b/src/utils/Autodeploy.ts @@ -1,7 +1,6 @@ import { Command } from "../interfaces" -import chalk from "chalk" +import color from "./functions/colors" import env from "./Env" -// import color from "./functions/colors" import { REST, RESTGetAPIApplicationGuildCommandResult, @@ -11,9 +10,6 @@ import { import fs = require("fs") type FileType = "js" | "ts" -const oldColor = chalk.hex("#f38ba8") -const newColor = chalk.hex("#b4befe") - export default async function autoDeployCommands(fileType: FileType) { const commands = [] let commandFiles: string[] = [] @@ -90,21 +86,17 @@ export default async function autoDeployCommands(fileType: FileType) { JSON.stringify(sortedCurrentCommandsInfo) ) { console.log( - // color.colorize("Commands are the same, skipping deploy.", "green"), - newColor("Commands are the same, skipping deploy."), + color("Commands are the same, skipping deploy.", "lavender"), ) - // console.log(color.colorize(newCmds, "green")) - console.log(newColor(newCmds)) + console.log(color(newCmds, "lavender")) return } try { console.log( - // color.colorize("Commands are different, starting deploy.", "red"), - oldColor("Commands are different, starting deploy."), + color("Commands are different, starting deploy.", "red"), ) - // console.log(color.colorize(currentCmds, "red")) - console.log(oldColor(currentCmds)) + console.log(color(currentCmds, "red")) console.log( `Started refreshing ${commands.length} application (/) commands.`, ) @@ -114,10 +106,8 @@ export default async function autoDeployCommands(fileType: FileType) { { body: commands }, )) as RESTPutAPIApplicationGuildCommandsJSONBody[] - // console.log(color.colorize("New commands deployed.", "green")) - // console.log(color.colorize(newCmds, "green")) - console.log(newColor("New commands deployed.")) - console.log(newColor(newCmds)) + console.log(color("New commands deployed.", "lavender")) + console.log(color(newCmds, "lavender")) console.log( `Successfully reloaded ${data.length} application (/) commands.`, ) diff --git a/src/utils/Client.ts b/src/utils/Client.ts index 20af18d..9a0b1cb 100644 --- a/src/utils/Client.ts +++ b/src/utils/Client.ts @@ -1,4 +1,5 @@ import { Client, Collection, GatewayIntentBits, Partials } from "discord.js" +import color from "./functions/colors" import { Command } from "../interfaces" import { ContextMenu } from "../interfaces" import { Button } from "../interfaces" @@ -37,17 +38,17 @@ export class ExtendedClient extends Client { async start() { let token: string if (process.env.NODE_ENV === "dev" && process.env.TYPESCRIPT) { - console.log("Running in development mode. [ts-node]") + console.log(color("Running in development mode. [ts-node]", "lavender")) loadAllEvents(this, "ts") token = env.dev.devtoken! autoDeployCommands("ts") } else if (process.env.NODE_ENV === "dev" && !process.env.TYPESCRIPT) { - console.log("Running in development mode.") + console.log(color("Running in development mode.", "lavender")) loadAllEvents(this, "js") token = env.dev.devtoken! autoDeployCommands("js") } else { - console.log("Running in production mode.") + console.log(color("Running in production mode.", "green")) loadAllEvents(this, "js") token = env.prod.token! } diff --git a/src/utils/Illegitimate.ts b/src/utils/Illegitimate.ts index de10feb..5a7bd9b 100644 --- a/src/utils/Illegitimate.ts +++ b/src/utils/Illegitimate.ts @@ -1,4 +1,5 @@ import { ExtendedClient as Client } from "./Client" +import color from "./functions/colors" import { Redis } from "ioredis" import env from "./Env" import { connect } from "mongoose" @@ -13,10 +14,10 @@ class Bot { client.start() loadCronEvents() redis.on("ready", () => { - console.log("Connected to Redis") + console.log(color("Connected to Redis", "green")) }) connect(env.prod.mongoURI!, {}).then(() => { - console.log("Connected to MongoDB") + console.log(color("Connected to MongoDB", "green")) }) } } diff --git a/src/utils/functions/colors.ts b/src/utils/functions/colors.ts index ab55a63..8692d94 100644 --- a/src/utils/functions/colors.ts +++ b/src/utils/functions/colors.ts @@ -1,4 +1,17 @@ +import chalk from "chalk" + const colors = { + red: "#f38ba8", + lavender: "#b4befe", + green: "#a6e3a1", + pink: "#f5c2e7" +} + +export default function color(text: string, type: keyof typeof colors) { + return chalk.hex(colors[type])(text) +} + +/* const colors = { reset: "\x1b[0m", bright: "\x1b[1m", dim: "\x1b[2m", @@ -28,4 +41,4 @@ const colors = { export default function colorize(text: string, color: keyof typeof colors) { return colors[color] + text + colors.reset -} \ No newline at end of file +} */ \ No newline at end of file