Skip to content

Commit

Permalink
Merge pull request appujet#617 from Beelzebub2/patch-6
Browse files Browse the repository at this point in the history
Add Themes to the console Logo
  • Loading branch information
LucasB25 authored Jul 14, 2024
2 parents 714c6c1 + 97ef6d9 commit 4864421
Showing 1 changed file with 91 additions and 6 deletions.
97 changes: 91 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,102 @@
import { promises as fs } from "node:fs";
// biome-ignore lint/style/noNamespaceImport: <explanation>
import * as fs from "node:fs";
import { ShardingManager } from "discord.js";

import config from "./config.js";
import Logger from "./structures/Logger.js";

const logger = new Logger();

class ThemeSelector {
/**
* Applies a yellow fire effect to the text.
*
* @param text - The input text to apply the effect to.
* @returns The processed text with the green fire effect.
*/
fire(text: string): string {
let fade = "";
let green = 250;

for (const line of text.split("\n")) {
fade += `\x1b[38;2;255;${green};0m${line}\x1b[0m\n`;
green = Math.max(0, green - 25);
}

return fade;
}

/**
* Applies a purple neon effect to the text.
*
* @param text - The input text to apply the effect to.
* @returns The processed text with the purple neon effect.
*/
purpleNeon(text: string): string {
let fade = "";
let purple = 255;

for (const line of text.split("\n")) {
fade += `\x1b[38;2;255;0;${purple}m${line}\x1b[0m\n`;
purple = Math.max(0, purple - 25);
}

return fade;
}

/**
* Applies a cyan effect to the text.
*
* @param text - The input text to apply the effect to.
* @returns The processed text with the cyan effect.
*/
cyan(text: string): string {
let fade = "";
let blue = 100;

for (const line of text.split("\n")) {
fade += `\x1b[38;2;0;255;${blue}m${line}\x1b[0m\n`;
if (blue < 255) {
blue = Math.min(255, blue + 15);
}
}

return fade;
}

/**
* Applies a water effect to the text.
*
* @param text - The input text to apply the effect to.
* @returns The processed text with the water effect.
*/
water(text: string): string {
let fade = "";
let green = 255;

for (const line of text.split("\n")) {
fade += `\x1b[38;2;0;${green};255m${line}\x1b[0m\n`;
if (green > 30) {
green = Math.max(30, green - 40);
}
}

return fade;
}
}

const theme = new ThemeSelector();

async function main(): Promise<void> {
try {
const logFilePath = "./src/utils/LavaLogo.txt";
const logFile = await fs.readFile(logFilePath, "utf-8");
if (!fs.existsSync("./src/utils/LavaLogo.txt")) {
logger.error("LavaLogo.txt file is missing");
process.exit(1);
}
console.clear();
const logFile = fs.readFileSync("./src/utils/LavaLogo.txt", "utf-8");
// biome-ignore lint/suspicious/noConsoleLog: <explanation>
console.log("\x1b[35m%s\x1b[0m", logFile);

console.log(theme.purpleNeon(logFile));
const manager = new ShardingManager("./dist/LavaClient.js", {
respawn: true,
token: config.token,
Expand All @@ -26,10 +111,10 @@ async function main(): Promise<void> {
});

await manager.spawn();

logger.start(`[CLIENT] ${manager.totalShards} shard(s) spawned.`);
} catch (err) {
logger.error("[CLIENT] An error has occurred:", err);
process.exit(1);
}
}

Expand Down

0 comments on commit 4864421

Please sign in to comment.