Updated to new color script
This commit is contained in:
@@ -4,6 +4,7 @@ import {
|
|||||||
color,
|
color,
|
||||||
devMessage,
|
devMessage,
|
||||||
} from "../../../config/options.json"
|
} from "../../../config/options.json"
|
||||||
|
import colorLog from "../../utils/functions/colors"
|
||||||
import { getGuild, getIGN } from "../../utils/Hypixel"
|
import { getGuild, getIGN } from "../../utils/Hypixel"
|
||||||
import { Cron, GuildData } from "../../interfaces"
|
import { Cron, GuildData } from "../../interfaces"
|
||||||
import Illegitimate from "../../utils/Illegitimate"
|
import Illegitimate from "../../utils/Illegitimate"
|
||||||
@@ -16,7 +17,7 @@ async function guildWeekly() {
|
|||||||
) as TextChannel
|
) as TextChannel
|
||||||
|
|
||||||
if (!channel) {
|
if (!channel) {
|
||||||
console.log("Guild log channel not found")
|
console.log(colorLog("Guild log channel not found", "red"))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { ChatInputCommandInteraction, ButtonInteraction } from "discord.js"
|
import { ChatInputCommandInteraction, ButtonInteraction } from "discord.js"
|
||||||
|
import color from "../../../utils/functions/colors"
|
||||||
import { Event } from "../../../interfaces"
|
import { Event } from "../../../interfaces"
|
||||||
|
|
||||||
export = {
|
export = {
|
||||||
@@ -10,29 +11,32 @@ export = {
|
|||||||
execute(interaction: ChatInputCommandInteraction | ButtonInteraction) {
|
execute(interaction: ChatInputCommandInteraction | ButtonInteraction) {
|
||||||
if (interaction.isCommand()) {
|
if (interaction.isCommand()) {
|
||||||
try {
|
try {
|
||||||
console.log(
|
console.log(color(
|
||||||
interaction.user.username +
|
interaction.user.username +
|
||||||
" ran " +
|
" ran " +
|
||||||
interaction.commandName +
|
interaction.commandName +
|
||||||
" " +
|
" " +
|
||||||
interaction.options.getSubcommand(),
|
interaction.options.getSubcommand(),
|
||||||
|
"pink")
|
||||||
)
|
)
|
||||||
} catch {
|
} catch {
|
||||||
console.log(
|
console.log(color(
|
||||||
interaction.user.username +
|
interaction.user.username +
|
||||||
" ran " +
|
" ran " +
|
||||||
interaction.commandName,
|
interaction.commandName,
|
||||||
|
"pink")
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (interaction.isButton()) {
|
if (interaction.isButton()) {
|
||||||
console.log(
|
console.log(color(
|
||||||
interaction.user.username +
|
interaction.user.username +
|
||||||
"#" +
|
"#" +
|
||||||
interaction.user.discriminator +
|
interaction.user.discriminator +
|
||||||
" clicked " +
|
" clicked " +
|
||||||
interaction.customId,
|
interaction.customId,
|
||||||
|
"pink")
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { Event } from "../../../interfaces"
|
import { Event } from "../../../interfaces"
|
||||||
import { ExtendedClient as Client } from "../../../utils/Client"
|
import { ExtendedClient as Client } from "../../../utils/Client"
|
||||||
|
import color from "../../../utils/functions/colors"
|
||||||
|
|
||||||
export = {
|
export = {
|
||||||
name: "conolelog",
|
name: "conolelog",
|
||||||
@@ -8,6 +9,6 @@ export = {
|
|||||||
event: "ready",
|
event: "ready",
|
||||||
|
|
||||||
execute(client: Client) {
|
execute(client: Client) {
|
||||||
console.log("Logged in as " + client.user!.tag + "!")
|
console.log(color("Logged in as " + client.user!.tag + "!", "green"))
|
||||||
},
|
},
|
||||||
} as Event
|
} as Event
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { Command } from "../interfaces"
|
import { Command } from "../interfaces"
|
||||||
import chalk from "chalk"
|
import color from "./functions/colors"
|
||||||
import env from "./Env"
|
import env from "./Env"
|
||||||
// import color from "./functions/colors"
|
|
||||||
import {
|
import {
|
||||||
REST,
|
REST,
|
||||||
RESTGetAPIApplicationGuildCommandResult,
|
RESTGetAPIApplicationGuildCommandResult,
|
||||||
@@ -11,9 +10,6 @@ import {
|
|||||||
import fs = require("fs")
|
import fs = require("fs")
|
||||||
type FileType = "js" | "ts"
|
type FileType = "js" | "ts"
|
||||||
|
|
||||||
const oldColor = chalk.hex("#f38ba8")
|
|
||||||
const newColor = chalk.hex("#b4befe")
|
|
||||||
|
|
||||||
export default async function autoDeployCommands(fileType: FileType) {
|
export default async function autoDeployCommands(fileType: FileType) {
|
||||||
const commands = []
|
const commands = []
|
||||||
let commandFiles: string[] = []
|
let commandFiles: string[] = []
|
||||||
@@ -90,21 +86,17 @@ export default async function autoDeployCommands(fileType: FileType) {
|
|||||||
JSON.stringify(sortedCurrentCommandsInfo)
|
JSON.stringify(sortedCurrentCommandsInfo)
|
||||||
) {
|
) {
|
||||||
console.log(
|
console.log(
|
||||||
// color.colorize("Commands are the same, skipping deploy.", "green"),
|
color("Commands are the same, skipping deploy.", "lavender"),
|
||||||
newColor("Commands are the same, skipping deploy."),
|
|
||||||
)
|
)
|
||||||
// console.log(color.colorize(newCmds, "green"))
|
console.log(color(newCmds, "lavender"))
|
||||||
console.log(newColor(newCmds))
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
console.log(
|
console.log(
|
||||||
// color.colorize("Commands are different, starting deploy.", "red"),
|
color("Commands are different, starting deploy.", "red"),
|
||||||
oldColor("Commands are different, starting deploy."),
|
|
||||||
)
|
)
|
||||||
// console.log(color.colorize(currentCmds, "red"))
|
console.log(color(currentCmds, "red"))
|
||||||
console.log(oldColor(currentCmds))
|
|
||||||
console.log(
|
console.log(
|
||||||
`Started refreshing ${commands.length} application (/) commands.`,
|
`Started refreshing ${commands.length} application (/) commands.`,
|
||||||
)
|
)
|
||||||
@@ -114,10 +106,8 @@ export default async function autoDeployCommands(fileType: FileType) {
|
|||||||
{ body: commands },
|
{ body: commands },
|
||||||
)) as RESTPutAPIApplicationGuildCommandsJSONBody[]
|
)) as RESTPutAPIApplicationGuildCommandsJSONBody[]
|
||||||
|
|
||||||
// console.log(color.colorize("New commands deployed.", "green"))
|
console.log(color("New commands deployed.", "lavender"))
|
||||||
// console.log(color.colorize(newCmds, "green"))
|
console.log(color(newCmds, "lavender"))
|
||||||
console.log(newColor("New commands deployed."))
|
|
||||||
console.log(newColor(newCmds))
|
|
||||||
console.log(
|
console.log(
|
||||||
`Successfully reloaded ${data.length} application (/) commands.`,
|
`Successfully reloaded ${data.length} application (/) commands.`,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { Client, Collection, GatewayIntentBits, Partials } from "discord.js"
|
import { Client, Collection, GatewayIntentBits, Partials } from "discord.js"
|
||||||
|
import color from "./functions/colors"
|
||||||
import { Command } from "../interfaces"
|
import { Command } from "../interfaces"
|
||||||
import { ContextMenu } from "../interfaces"
|
import { ContextMenu } from "../interfaces"
|
||||||
import { Button } from "../interfaces"
|
import { Button } from "../interfaces"
|
||||||
@@ -37,17 +38,17 @@ export class ExtendedClient extends Client {
|
|||||||
async start() {
|
async start() {
|
||||||
let token: string
|
let token: string
|
||||||
if (process.env.NODE_ENV === "dev" && process.env.TYPESCRIPT) {
|
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")
|
loadAllEvents(this, "ts")
|
||||||
token = env.dev.devtoken!
|
token = env.dev.devtoken!
|
||||||
autoDeployCommands("ts")
|
autoDeployCommands("ts")
|
||||||
} else if (process.env.NODE_ENV === "dev" && !process.env.TYPESCRIPT) {
|
} 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")
|
loadAllEvents(this, "js")
|
||||||
token = env.dev.devtoken!
|
token = env.dev.devtoken!
|
||||||
autoDeployCommands("js")
|
autoDeployCommands("js")
|
||||||
} else {
|
} else {
|
||||||
console.log("Running in production mode.")
|
console.log(color("Running in production mode.", "green"))
|
||||||
loadAllEvents(this, "js")
|
loadAllEvents(this, "js")
|
||||||
token = env.prod.token!
|
token = env.prod.token!
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { ExtendedClient as Client } from "./Client"
|
import { ExtendedClient as Client } from "./Client"
|
||||||
|
import color from "./functions/colors"
|
||||||
import { Redis } from "ioredis"
|
import { Redis } from "ioredis"
|
||||||
import env from "./Env"
|
import env from "./Env"
|
||||||
import { connect } from "mongoose"
|
import { connect } from "mongoose"
|
||||||
@@ -13,10 +14,10 @@ class Bot {
|
|||||||
client.start()
|
client.start()
|
||||||
loadCronEvents()
|
loadCronEvents()
|
||||||
redis.on("ready", () => {
|
redis.on("ready", () => {
|
||||||
console.log("Connected to Redis")
|
console.log(color("Connected to Redis", "green"))
|
||||||
})
|
})
|
||||||
connect(env.prod.mongoURI!, {}).then(() => {
|
connect(env.prod.mongoURI!, {}).then(() => {
|
||||||
console.log("Connected to MongoDB")
|
console.log(color("Connected to MongoDB", "green"))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,17 @@
|
|||||||
|
import chalk from "chalk"
|
||||||
|
|
||||||
const colors = {
|
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",
|
reset: "\x1b[0m",
|
||||||
bright: "\x1b[1m",
|
bright: "\x1b[1m",
|
||||||
dim: "\x1b[2m",
|
dim: "\x1b[2m",
|
||||||
@@ -28,4 +41,4 @@ const colors = {
|
|||||||
|
|
||||||
export default function colorize(text: string, color: keyof typeof colors) {
|
export default function colorize(text: string, color: keyof typeof colors) {
|
||||||
return colors[color] + text + colors.reset
|
return colors[color] + text + colors.reset
|
||||||
}
|
} */
|
||||||
Reference in New Issue
Block a user