diff --git a/scripts/deploy-commands.ts b/scripts/deploy-commands.ts index 1a7cc39..6e5489c 100644 --- a/scripts/deploy-commands.ts +++ b/scripts/deploy-commands.ts @@ -2,7 +2,7 @@ import { REST, RESTPutAPIApplicationCommandsJSONBody, Routes } from "discord.js" import fs from "node:fs" import { ICommand } from "../src/interfaces" import env from "../src/utils/Env" -import color from "../src/utils/functions/colors" +import { color } from "../src/utils/functions/colors" const rest = new REST({ version: "10" }).setToken(env.prod.token) const commands: RESTPutAPIApplicationCommandsJSONBody = [] diff --git a/src/commands/anime.ts b/src/commands/anime.ts index 43c7283..4cf9c73 100644 --- a/src/commands/anime.ts +++ b/src/commands/anime.ts @@ -2,14 +2,12 @@ import { anilist } from "anilist" import { devMessage, embedColor } from "config/options.js" import { SlashCommandBuilder } from "discord.js" import { ICommand } from "interfaces" -import { capitalizeFirstLetter, removeIndents } from "utils/functions/funcs.js" export default { name: "anime", description: "Anime subcommands", public: true, dev: false, - subcommands: true, data: new SlashCommandBuilder() .setName("anime") @@ -59,14 +57,14 @@ export default { const animeEpisodes = anime.episodes ? animeEpisodesRaw : "No episodes available" const animeStartDate = [anime.startDate?.day || "??", anime.startDate?.month || "??", anime.startDate?.year || "????"].join(".") const animeEndDate = [anime.endDate?.day || "??", anime.endDate?.month || "??", anime.endDate?.year || "????"].join(".") - const animeSeasonRaw = capitalizeFirstLetter(anime.season ?? "null") + " " + anime.startDate?.year + const animeSeasonRaw = anime.season?.capitalizeFirstLetter() + " " + anime.startDate?.year const animeSeason = anime.season ? animeSeasonRaw : "No season available" await interaction.editReply({ embeds: [{ title: romaji + " | " + english, url: anime.siteUrl || "", - description: removeIndents(` + description: ` **Description:** ${animeDescription} **Genres:** ${anime.genres.join(", ")} @@ -76,7 +74,7 @@ export default { **Season:** ${animeSeason} **Start Date:** ${animeStartDate} **End Date:** ${animeEndDate} - `), + `.removeIndents(), color: embedColor, thumbnail: { url: anime.coverImage?.medium || "" diff --git a/src/commands/ban.ts b/src/commands/ban.ts index 1a2f7b1..303bc91 100644 --- a/src/commands/ban.ts +++ b/src/commands/ban.ts @@ -2,7 +2,6 @@ import { devMessage, embedColor } from "config/options.js" import { admin, helper } from "config/roles.js" import { GuildMember, PermissionFlagsBits, SlashCommandBuilder, userMention } from "discord.js" import { ICommand } from "interfaces" -import { removeIndents } from "utils/functions/funcs.js" import logToChannel from "utils/functions/logtochannel.js" export default { @@ -102,12 +101,12 @@ export default { icon_url: mod.user.avatarURL() || undefined }, title: "Member Banned", - description: removeIndents(` + description: ` **User:** ${userMention(member.user.id)} **Mod:** ${userMention(mod.user.id)} **Reason:** ${reason} **Messages Deleted:** ${messageDeletionDays} days - `), + `.removeIndents(), color: embedColor, thumbnail: { url: mod.user.avatarURL() || "" diff --git a/src/commands/botinfo.ts b/src/commands/botinfo.ts index 77847e5..5f57c9e 100644 --- a/src/commands/botinfo.ts +++ b/src/commands/botinfo.ts @@ -5,7 +5,6 @@ import { ICommand } from "interfaces" import { createRequire } from "node:module" import os from "os" import prettyMs from "pretty-ms" -import { removeIndents } from "utils/functions/funcs.js" const require = createRequire(import.meta.url) const { dependencies, devDependencies } = require("../../package.json") @@ -46,7 +45,7 @@ export default { await interaction.reply({ embeds: [{ title: "Bot Info", - description: removeIndents(` + description: ` __**Bot**__ > **Name**: \`${client.user!.username}\` > **ID**: \`${client.user!.id}\` @@ -67,7 +66,7 @@ export default { > **Channels:** \`${client.channels.cache.size}\` > **Users:** \`${client.users.cache.size}\` > **Roles:** \`${client.guilds.cache.reduce((a, b) => a + b.roles.cache.size, 0)}\` - `), + `.removeIndents(), thumbnail: { url: client.user!.avatarURL() || "" }, diff --git a/src/commands/clear.ts b/src/commands/clear.ts index 5ec9782..768cee0 100644 --- a/src/commands/clear.ts +++ b/src/commands/clear.ts @@ -1,7 +1,6 @@ import { embedColor } from "config/options.js" import { channelMention, PermissionFlagsBits, SlashCommandBuilder, TextChannel, userMention } from "discord.js" import { ICommand } from "interfaces" -import { removeIndents } from "utils/functions/funcs.js" import logToChannel from "utils/functions/logtochannel.js" export default { @@ -53,11 +52,11 @@ export default { icon_url: interaction.user.avatarURL() || undefined }, title: "Messages Cleared", - description: removeIndents(` + description: ` **Channel:** ${channelMention(channel.id)} **Amount:** \`${messages.size}\` messages **Mod:** ${userMention(interaction.user.id)} - `), + `.removeIndents(), color: embedColor, thumbnail: { url: interaction.user.avatarURL() || "" diff --git a/src/commands/forceunverify.ts b/src/commands/forceunverify.ts index 86071b4..6a3605c 100644 --- a/src/commands/forceunverify.ts +++ b/src/commands/forceunverify.ts @@ -2,7 +2,6 @@ import { devMessage, embedColor } from "config/options.js" import { GuildMember, PermissionFlagsBits, SlashCommandBuilder, userMention } from "discord.js" import { ICommand } from "interfaces" import verify from "schemas/verifyTag.js" -import { removeIndents } from "utils/functions/funcs.js" import logToChannel from "utils/functions/logtochannel.js" import roleManage from "utils/functions/rolesmanage.js" import { getIGN } from "utils/Hypixel.js" @@ -58,12 +57,12 @@ export default { name: mod.username, icon_url: mod.avatarURL() || undefined }, - description: removeIndents(` + description: ` **User:** ${userMention(member.user.id)} **Mod:** ${userMention(mod.id)} **IGN:** \`${ign}\` **UUID:** \`${uuid}\` - `), + `.removeIndents(), color: embedColor, thumbnail: { url: mod.avatarURL() || "" diff --git a/src/commands/forceupdate.ts b/src/commands/forceupdate.ts index 0aa5407..e871aec 100644 --- a/src/commands/forceupdate.ts +++ b/src/commands/forceupdate.ts @@ -3,7 +3,6 @@ import { waitingListRole } from "config/roles.js" import { GuildMember, PermissionFlagsBits, SlashCommandBuilder, userMention } from "discord.js" import { ICommand } from "interfaces" import verify from "schemas/verifyTag.js" -import { removeIndents } from "utils/functions/funcs.js" import roleManage from "utils/functions/rolesmanage.js" import { getGuild, getHeadURL, getIGN } from "utils/Hypixel.js" @@ -85,11 +84,11 @@ export default { await interaction.editReply({ embeds: [{ - description: removeIndents(` + description: ` ${usermentioned} was given the \`Default Member\` role. IGN: \`${ign}\` - `), + `.removeIndents(), color: embedColor, thumbnail: { url: head! @@ -159,11 +158,11 @@ export default { await interaction.editReply({ embeds: [{ - description: removeIndents(` + description: ` ${usermentioned} was given the \`${replyRank}\` role. IGN: \`${ign}\` - `), + `.removeIndents(), color: embedColor, thumbnail: { url: head! diff --git a/src/commands/forceverify.ts b/src/commands/forceverify.ts index e7cc6fd..6ecc1ae 100644 --- a/src/commands/forceverify.ts +++ b/src/commands/forceverify.ts @@ -2,7 +2,6 @@ import { devMessage, embedColor, hypixelGuildID } from "config/options.js" import { GuildMember, PermissionFlagsBits, SlashCommandBuilder, userMention } from "discord.js" import { ICommand } from "interfaces" import verify from "schemas/verifyTag.js" -import { removeIndents } from "utils/functions/funcs.js" import logToChannel from "utils/functions/logtochannel.js" import roleManage from "utils/functions/rolesmanage.js" import { getGuild, getHeadURL, getPlayer, getUUID } from "utils/Hypixel.js" @@ -173,12 +172,12 @@ export default { icon_url: mod.avatarURL() || undefined }, title: "Force Verified", - description: removeIndents(` + description: ` **User:** ${userMention(user.id)} **Mod:** ${userMention(mod.id)} **IGN:** \`${player.displayname}\` **UUID:** \`${uuid}\` - `), + `.removeIndents(), color: embedColor, thumbnail: { url: mod.avatarURL() || "" diff --git a/src/commands/instructions.ts b/src/commands/instructions.ts index 85d437f..c0e8612 100644 --- a/src/commands/instructions.ts +++ b/src/commands/instructions.ts @@ -1,7 +1,6 @@ import { devMessage, embedColor, instructionsgif } from "config/options.js" import { PermissionFlagsBits, SlashCommandBuilder } from "discord.js" import { ICommand } from "interfaces" -import { removeIndents } from "utils/functions/funcs.js" export default { name: "instructions", @@ -19,14 +18,14 @@ export default { await interaction.reply({ embeds: [{ title: "Verification", - description: removeIndents(` + description: ` - Log onto hypixel. - Right click with the head in your hotbar. - Click on the social media icon. - Click on the discord icon. - Type your username in the chat and press enter. - Run the \`/verify\` command in this channel. - `), + `.removeIndents(), thumbnail: { url: interaction.guild?.iconURL() || "" }, diff --git a/src/commands/kick.ts b/src/commands/kick.ts index a00ecc7..03aa3ea 100644 --- a/src/commands/kick.ts +++ b/src/commands/kick.ts @@ -2,7 +2,6 @@ import { devMessage, embedColor } from "config/options.js" import { admin, helper } from "config/roles.js" import { GuildMember, PermissionFlagsBits, SlashCommandBuilder, userMention } from "discord.js" import { ICommand } from "interfaces" -import { removeIndents } from "utils/functions/funcs.js" import logToChannel from "utils/functions/logtochannel.js" export default { @@ -76,11 +75,11 @@ export default { icon_url: mod.user.avatarURL() || undefined }, title: "Member Kicked", - description: removeIndents(` + description: ` **User:** ${userMention(member.user.id)} **Mod:** ${userMention(mod.user.id)} **Reason:** ${reason} - `), + `.removeIndents(), color: embedColor, thumbnail: { url: mod.user.avatarURL() || "" diff --git a/src/commands/music/nowplaying.ts b/src/commands/music/nowplaying.ts index 66f8efb..0ab34c6 100644 --- a/src/commands/music/nowplaying.ts +++ b/src/commands/music/nowplaying.ts @@ -1,7 +1,6 @@ import { embedColor } from "config/options.js" import { useMainPlayer } from "discord-player" import { ChatInputCommandInteraction } from "discord.js" -import { removeIndents } from "utils/functions/funcs.js" export default async function nowplaying(interaction: ChatInputCommandInteraction) { await interaction.deferReply() @@ -42,11 +41,11 @@ export default async function nowplaying(interaction: ChatInputCommandInteractio await interaction.editReply({ embeds: [{ title: "Now Playing", - description: removeIndents(` + description: ` [${current.title}](${current.url}) ${progressBar} - `), + `.removeIndents(), color: embedColor, thumbnail: { url: current.thumbnail diff --git a/src/commands/remove.ts b/src/commands/remove.ts index 10fb49b..09c1afd 100644 --- a/src/commands/remove.ts +++ b/src/commands/remove.ts @@ -3,7 +3,6 @@ import { waitingListRole } from "config/roles.js" import { GuildMember, PermissionFlagsBits, SlashCommandBuilder, userMention } from "discord.js" import { ICommand } from "interfaces" import waitinglist from "schemas/waitinglistTag.js" -import { removeIndents } from "utils/functions/funcs.js" import logToChannel from "utils/functions/logtochannel.js" export default { @@ -58,11 +57,11 @@ export default { icon_url: mod.avatarURL() || undefined }, title: "Waiting List - Remove User", - description: removeIndents(` + description: ` **User:** ${userMention(member.user.id)} **Reason:** ${reason} **Mod:** ${userMention(mod.id)} - `), + `.removeIndents(), color: embedColor, thumbnail: { url: mod.avatarURL() || "" diff --git a/src/commands/setnick.ts b/src/commands/setnick.ts index 4a9f3f0..7dfe691 100644 --- a/src/commands/setnick.ts +++ b/src/commands/setnick.ts @@ -1,7 +1,6 @@ import { devMessage, embedColor } from "config/options.js" import { GuildMember, PermissionFlagsBits, SlashCommandBuilder, userMention } from "discord.js" import { ICommand } from "interfaces" -import { removeIndents } from "utils/functions/funcs.js" import logToChannel from "utils/functions/logtochannel.js" export default { @@ -49,11 +48,11 @@ export default { icon_url: interaction.user.avatarURL() || undefined }, title: "Nickname", - description: removeIndents(` + description: ` **User:** ${userMention(member.id)} **Nickname:** ${nickname} **Moderator:** ${userMention(interaction.user.id)} - `), + `.removeIndents(), color: embedColor, thumbnail: { url: interaction.user.avatarURL() || "" diff --git a/src/commands/slowmode.ts b/src/commands/slowmode.ts index 26b1800..9952c5a 100644 --- a/src/commands/slowmode.ts +++ b/src/commands/slowmode.ts @@ -1,7 +1,6 @@ import { devMessage, embedColor } from "config/options.js" import { channelMention, ChannelType, PermissionFlagsBits, SlashCommandBuilder, TextChannel, userMention } from "discord.js" import { ICommand } from "interfaces" -import { removeIndents } from "utils/functions/funcs.js" import logToChannel from "utils/functions/logtochannel.js" export default { @@ -55,11 +54,11 @@ export default { icon_url: interaction.user.avatarURL() || undefined }, title: "Slowmode Update", - description: removeIndents(` + description: ` **Channel:** ${channelMention(channel.id)} **Slowmode:** ${seconds} seconds **Mod:** ${userMention(interaction.user.id)} - `), + `.removeIndents(), color: embedColor, thumbnail: { url: interaction.user.avatarURL() || "" diff --git a/src/commands/staff/updateall.ts b/src/commands/staff/updateall.ts index d3b57a0..c1e4cd4 100644 --- a/src/commands/staff/updateall.ts +++ b/src/commands/staff/updateall.ts @@ -3,7 +3,7 @@ import { ChatInputCommandInteraction, GuildMember } from "discord.js" import { IGuildData } from "interfaces" import verify from "schemas/verifyTag.js" import env from "utils/Env.js" -import color from "utils/functions/colors.js" +import { color } from "utils/functions/colors.js" import roleManage from "utils/functions/rolesmanage.js" import { getGuild, getIGN } from "utils/Hypixel.js" diff --git a/src/commands/timeout.ts b/src/commands/timeout.ts index ba2dc63..812d1f7 100644 --- a/src/commands/timeout.ts +++ b/src/commands/timeout.ts @@ -3,7 +3,6 @@ import { GuildMember, PermissionFlagsBits, SlashCommandBuilder, userMention } fr import { ICommand } from "interfaces" import ms from "ms" import prettyMs from "pretty-ms" -import { removeIndents } from "utils/functions/funcs.js" import logToChannel from "utils/functions/logtochannel.js" export default { @@ -144,12 +143,12 @@ export default { icon_url: mod.user.avatarURL() || undefined }, title: title, - description: removeIndents(` + description: ` **User:** ${userMention(target.id)} ${timeouttime === null ? "**Time:** `None`" : "**Time:** `" + prettyTime + "`"} **Reason:** \`${reason}\` **Mod:** ${userMention(mod.id)} - `), + `.removeIndents(), color: embedColor, thumbnail: { url: mod.user.avatarURL() || "" diff --git a/src/commands/unban.ts b/src/commands/unban.ts index 6b53459..1d64b23 100644 --- a/src/commands/unban.ts +++ b/src/commands/unban.ts @@ -1,7 +1,6 @@ import { devMessage, embedColor } from "config/options.js" import { PermissionFlagsBits, SlashCommandBuilder, User, userMention } from "discord.js" import { ICommand } from "interfaces" -import { removeIndents } from "utils/functions/funcs.js" import logToChannel from "utils/functions/logtochannel.js" export default { @@ -69,11 +68,11 @@ export default { icon_url: mod.avatarURL() || undefined }, title: "Member Unbanned", - description: removeIndents(` + description: ` **User:** ${userMention(user!.id)} **Mod:** ${userMention(mod.id)} **Reason:** ${reason} - `), + `.removeIndents(), color: embedColor, thumbnail: { url: mod.avatarURL() || "" diff --git a/src/commands/update.ts b/src/commands/update.ts index 193df82..748e87f 100644 --- a/src/commands/update.ts +++ b/src/commands/update.ts @@ -3,7 +3,6 @@ import { waitingListRole } from "config/roles.js" import { GuildMember, SlashCommandBuilder } from "discord.js" import { ICommand } from "interfaces" import verify from "schemas/verifyTag.js" -import { removeIndents } from "utils/functions/funcs.js" import roleManage from "utils/functions/rolesmanage.js" import { getGuild, getHeadURL, getIGN } from "utils/Hypixel.js" @@ -68,11 +67,11 @@ export default { await interaction.editReply({ embeds: [{ - description: removeIndents(` + description: ` Updated your roles to \`Default Member\` IGN: \`${ign}\` - `), + `.removeIndents(), color: embedColor, thumbnail: { url: head! @@ -143,11 +142,11 @@ export default { await interaction.editReply({ embeds: [{ - description: removeIndents(` + description: ` Updated your roles to \`${replyRank}\` IGN: \`${ign}\` - `), + `.removeIndents(), color: embedColor, thumbnail: { url: head! diff --git a/src/components/buttons/guildapplicationaccept.ts b/src/components/buttons/guildapplicationaccept.ts index 5accbdc..ed9e7d3 100644 --- a/src/components/buttons/guildapplicationaccept.ts +++ b/src/components/buttons/guildapplicationaccept.ts @@ -4,7 +4,7 @@ import { ActionRowBuilder, ButtonBuilder, ButtonStyle, TextChannel } from "disco import { IButton } from "interfaces" import guildapp from "schemas/guildAppTag.js" import waitingList from "schemas/waitinglistTag.js" -import color from "utils/functions/colors.js" +import { color } from "utils/functions/colors.js" import { getGuild, getIGN } from "utils/Hypixel.js" export default { diff --git a/src/enviroment.d.ts b/src/enviroment.d.ts index 9b646ef..b138f7e 100644 --- a/src/enviroment.d.ts +++ b/src/enviroment.d.ts @@ -7,4 +7,11 @@ declare global { } } +declare global { + interface String { + removeIndents(): string + capitalizeFirstLetter(): string + } +} + export {} diff --git a/src/events/cron/weeklyGexp.ts b/src/events/cron/weeklyGexp.ts index 670838a..11c768a 100644 --- a/src/events/cron/weeklyGexp.ts +++ b/src/events/cron/weeklyGexp.ts @@ -1,7 +1,7 @@ import { devMessage, embedColor, guildLogChannel, hypixelGuildID } from "config/options.js" import { TextChannel } from "discord.js" import { ICron, IGuildData } from "interfaces" -import color from "utils/functions/colors.js" +import { color } from "utils/functions/colors.js" import { getGuild, getIGN } from "utils/Hypixel.js" import { client } from "utils/Illegitimate.js" diff --git a/src/events/server/interactions/logBtnsCmds.ts b/src/events/server/interactions/logBtnsCmds.ts index 2d5bbe7..3074ed1 100644 --- a/src/events/server/interactions/logBtnsCmds.ts +++ b/src/events/server/interactions/logBtnsCmds.ts @@ -1,6 +1,6 @@ import { ButtonInteraction, ChatInputCommandInteraction } from "discord.js" import { IEvent } from "interfaces" -import color from "utils/functions/colors.js" +import { color } from "utils/functions/colors.js" export default { name: "logBtnsCmds", diff --git a/src/events/server/ready/consolelog.ts b/src/events/server/ready/consolelog.ts index 39ee5da..157184d 100644 --- a/src/events/server/ready/consolelog.ts +++ b/src/events/server/ready/consolelog.ts @@ -1,6 +1,6 @@ import { IEvent } from "interfaces" import { ExtendedClient as Client } from "utils/Client.js" -import color from "utils/functions/colors.js" +import { color } from "utils/functions/colors.js" export default { name: "conolelog", diff --git a/src/utils/Autodeploy.ts b/src/utils/Autodeploy.ts index cc2dd93..c9c27fa 100644 --- a/src/utils/Autodeploy.ts +++ b/src/utils/Autodeploy.ts @@ -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) { diff --git a/src/utils/Client.ts b/src/utils/Client.ts index 66bb386..5956d5a 100644 --- a/src/utils/Client.ts +++ b/src/utils/Client.ts @@ -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 = new Collection() diff --git a/src/utils/Events/autocomplete.ts b/src/utils/Events/autocomplete.ts index d34de8b..324bcd4 100644 --- a/src/utils/Events/autocomplete.ts +++ b/src/utils/Events/autocomplete.ts @@ -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 diff --git a/src/utils/Events/button.ts b/src/utils/Events/button.ts index db0f734..ba98041 100644 --- a/src/utils/Events/button.ts +++ b/src/utils/Events/button.ts @@ -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 diff --git a/src/utils/Events/command.ts b/src/utils/Events/command.ts index 155a2b6..f56d4aa 100644 --- a/src/utils/Events/command.ts +++ b/src/utils/Events/command.ts @@ -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 diff --git a/src/utils/Events/contextmenu.ts b/src/utils/Events/contextmenu.ts index 617dff9..4f0e2a3 100644 --- a/src/utils/Events/contextmenu.ts +++ b/src/utils/Events/contextmenu.ts @@ -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 diff --git a/src/utils/Events/modal.ts b/src/utils/Events/modal.ts index 4216583..9f7b126 100644 --- a/src/utils/Events/modal.ts +++ b/src/utils/Events/modal.ts @@ -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 diff --git a/src/utils/Illegitimate.ts b/src/utils/Illegitimate.ts index 1bf7201..37723b9 100644 --- a/src/utils/Illegitimate.ts +++ b/src/utils/Illegitimate.ts @@ -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 } diff --git a/src/utils/functions/colors.ts b/src/utils/functions/colors.ts index 72df00f..6889811 100644 --- a/src/utils/functions/colors.ts +++ b/src/utils/functions/colors.ts @@ -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", diff --git a/src/utils/functions/funcs.ts b/src/utils/functions/funcs.ts deleted file mode 100644 index 53297e7..0000000 --- a/src/utils/functions/funcs.ts +++ /dev/null @@ -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, "") -}