Changed small functions to methods

Added custom color function
This commit is contained in:
2024-09-07 20:09:29 +02:00
parent a9fb41cece
commit 7a2a136f30
33 changed files with 74 additions and 76 deletions

View File

@@ -3,7 +3,7 @@ import fs from "fs"
import { ICommand } from "interfaces"
import { ExtendedClient } from "./Client.js"
import env from "./Env.js"
import color from "./functions/colors.js"
import { color } from "./functions/colors.js"
type FileType = "js" | "ts"
export default async function autoDeployCommands(fileType: FileType, client: ExtendedClient) {

View File

@@ -2,7 +2,7 @@ import { Client, Collection, GatewayIntentBits, Partials } from "discord.js"
import { IAutocomplete, IButton, ICommand, IContextMenu, IModal } from "interfaces"
import autoDeployCommands from "./Autodeploy.js"
import env from "./Env.js"
import color from "./functions/colors.js"
import { color } from "./functions/colors.js"
export class ExtendedClient extends Client {
commands: Collection<string, ICommand> = new Collection()

View File

@@ -4,7 +4,7 @@ import fs from "fs"
import { IAutocomplete } from "interfaces"
import path from "path"
import { ExtendedClient as Client } from "utils/Client.js"
import color from "utils/functions/colors.js"
import { color } from "utils/functions/colors.js"
import logToChannel from "utils/functions/logtochannel.js"
type FileType = "js" | "ts"
const __dirname = import.meta.dirname

View File

@@ -4,7 +4,7 @@ import fs from "fs"
import { IButton } from "interfaces"
import path from "path"
import { ExtendedClient as Client } from "utils/Client.js"
import color from "utils/functions/colors.js"
import { color } from "utils/functions/colors.js"
import logToChannel from "utils/functions/logtochannel.js"
type FileType = "js" | "ts"
const __dirname = import.meta.dirname

View File

@@ -4,7 +4,7 @@ import fs from "fs"
import { ICommand } from "interfaces"
import path from "path"
import { ExtendedClient as Client } from "utils/Client.js"
import color from "utils/functions/colors.js"
import { color } from "utils/functions/colors.js"
import logToChannel from "utils/functions/logtochannel.js"
type FileType = "js" | "ts"
const __dirname = import.meta.dirname

View File

@@ -4,7 +4,7 @@ import fs from "fs"
import { IContextMenu } from "interfaces"
import path from "path"
import { ExtendedClient as Client } from "utils/Client.js"
import color from "utils/functions/colors.js"
import { color } from "utils/functions/colors.js"
import logToChannel from "utils/functions/logtochannel.js"
type FileType = "js" | "ts"
const __dirname = import.meta.dirname

View File

@@ -4,7 +4,7 @@ import fs from "fs"
import { IModal } from "interfaces"
import path from "path"
import { ExtendedClient as Client } from "utils/Client.js"
import color from "utils/functions/colors.js"
import { color } from "utils/functions/colors.js"
import logToChannel from "utils/functions/logtochannel.js"
type FileType = "js" | "ts"
const __dirname = import.meta.dirname

View File

@@ -1,7 +1,7 @@
import { Redis } from "ioredis"
import { ExtendedClient as Client } from "utils/Client.js"
import env from "utils/Env.js"
import color from "utils/functions/colors.js"
import { color } from "utils/functions/colors.js"
// import { connect } from "mongoose"
import { Player } from "discord-player"
import { YoutubeiExtractor } from "discord-player-youtubei"
@@ -38,6 +38,7 @@ class Illegitimate {
await player.extractors.register(YoutubeiExtractor, {})
await client.start()
await this.databases()
this.loadMethods()
}
private async databases() {
@@ -71,6 +72,16 @@ class Illegitimate {
}
}
}
private loadMethods() {
String.prototype.removeIndents = function(this: string) {
return this.replace(/^ */gm, "")
}
String.prototype.capitalizeFirstLetter = function(this: string) {
return this[0].toUpperCase() + this.slice(1).toLowerCase()
}
}
}
export { client, Illegitimate, redis, sequelize }

View File

@@ -7,10 +7,14 @@ const colors = {
pink: "#f5c2e7"
}
export default function color(text: string, type: keyof typeof colors) {
export function color(text: string, type: keyof typeof colors) {
return chalk.hex(colors[type])(text)
}
export function colorCustom(text: string, color: string) {
return chalk.hex(color)(text)
}
/* const colors = {
reset: "\x1b[0m",
bright: "\x1b[1m",

View File

@@ -1,7 +0,0 @@
export function capitalizeFirstLetter(str: string): string {
return str[0].toUpperCase() + str.slice(1).toLowerCase()
}
export function removeIndents(str: string): string {
return str.replace(/^ */gm, "")
}