// index.
js - NovaGen BACKUP (Premium Purple Edition with Progress Bar)
// Requirements: [Link], express, dotenv, fs, path
import { Client, GatewayIntentBits, EmbedBuilder, PermissionsBitField } from
"[Link]";
import express from "express";
import dotenv from "dotenv";
import fs from "fs";
import path from "path";
[Link]();
// ---------- Keep-alive ----------
const app = express();
💜
const PORT = [Link] || 3000;
[Link]("/", (req, res) => [Link](" Hexa Gen Bot is online & running
smoothly."));
[Link](PORT, () => [Link](`
`));
🌐 Keep-alive server running on port ${PORT}
// ---------- Setup Paths ----------
const ROOT = [Link]();
const STOCKS_DIR = [Link](ROOT, "stocks");
const CONFIG_PATH = [Link](ROOT, "[Link]");
if () [Link](STOCKS_DIR, { recursive: true });
if () {
const defaultCfg = {
genChannel: null,
cooldownSeconds: 30,
cstatus: "NovaGen | [Link]
verifymessage: "Set your custom status to the required text and run
$cstatus",
accessRole: "Free Gen Access"
};
[Link](CONFIG_PATH, [Link](defaultCfg, null, 2));
}
// ---------- Helpers ----------
function loadConfig() {
try { return [Link]([Link](CONFIG_PATH, "utf8")); }
catch { return null; }
}
function saveConfig(cfg) { [Link](CONFIG_PATH, [Link](cfg,
null, 2)); }
function normalizeService(name) { return name?.toString().trim().toLowerCase()
|| null; }
function serviceFile(service) { return [Link](STOCKS_DIR, `$
{service}.txt`); }
function readStock(service) {
const f = serviceFile(service);
if () return [];
return [Link](f, "utf8").split(/\r?\n/).map(x =>
[Link]()).filter(Boolean);
}
function writeStock(service, arr) { [Link](serviceFile(service),
[Link]("\n")); }
function appendStock(service, arr) {
if (!arr || ![Link]) return;
[Link](serviceFile(service), [Link]("\n") + "\n");
}
function listServices() {
return [Link](STOCKS_DIR).filter(f => [Link](".txt")).map(f =>
[Link](".txt", ""));
}
function deleteStock(service) {
const file = serviceFile(service);
if ([Link](file)) [Link](file);
}
// ---------- Parser ----------
function parseAccountsFromText(text) {
if (!text) return [];
const clean = [Link](/\r\n/g, "\n").replace(/\t/g, " ").trim();
const pattern = /[^\s:]+@[^\s:]+\.[^\s:]+:[^\s]+/g;
const matches = [Link](pattern);
if (matches && [Link]) return [Link](new Set([Link](x =>
[Link]())));
const lines = [Link](/\n+/).map(x => [Link]()).filter(Boolean);
return [Link](new Set([Link](x => /\S+:\S+/.test(x))));
}
// ---------- Progress Bar ----------
function createProgressBar(count, max = 50) {
const filled = [Link](count, max);
}
⬛
const empty = max - filled;
return "".repeat(filled) + "⬛ ".repeat(empty); // Purple filled blocks
// ---------- Discord Client ----------
const client = new Client({
intents: [
[Link],
[Link],
[Link],
[Link],
[Link]
]
});
[Link]("❌
if (![Link]) {
[Link](1);
Missing TOKEN in .env");
const PREFIX = "$";
const cooldowns = new Map();
// Embed helper
function mkEmbed({ title = "", desc = "", color = "#9b59b6", footer = "Hexa Gen
Premium" }) {
const e = new EmbedBuilder().setColor(color).setTimestamp();
if (title) [Link](title);
if (desc) [Link](desc);
if (footer) [Link]({ text: footer });
return e;
}
function cap(s) { return s ? s[0].toUpperCase() + [Link](1) : s; }
// ---------- Ready ----------
[Link](`🤖
function onReady() {
Logged in as ${[Link]}`);
try { [Link]({ activities: [{ name: " 💜 NovaGen • $help",
type: 3 }], status: "idle" }); } catch {}
}
[Link]("ready", onReady);
[Link]("clientReady", onReady);
// ---------- Commands ----------
[Link]("messageCreate", async (msg) => {
if ([Link] || ) return;
const cfg = loadConfig();
const args = [Link]([Link]).trim().split(/\s+/);
const cmd = [Link]().toLowerCase();
// ---------- HELP ----------
if (["help", "commands"].includes(cmd)) {
title: "
desc:
📜
return [Link]({ embeds: [mkEmbed({
NovaGen — Command List",
"**User Commands**\n" +
"📦🔐
"🪄 `$gen <service>` — Generate 1 account (DM)\n" +
`$stock <service|all>` — View stock counts with progress bar\n" +
"
" 💬 `$genhelp` — How to verify and use gen\n" +
`$cstatus` — Verify by your Discord status\n\n" +
" 📥🧹
"**Admin Commands**\n" +
`$addstock <service>` — Add stock (paste or attach .txt)\n" +
"
" 📋 `$clearstock <service>` — Delete a service stock\n" +
`$listservices` — Show available services\n" +
"
🔁💡
"⚙️ `$config <option>` — Edit settings\n" +
" `$refresh` — Reload bot config\n\n" +
Example: `$addstock netflix` (attach .txt or paste accounts)."
})]});
}
// ---------- GENHELP ----------
if (cmd === "genhelp") {
title: " 🔑
return [Link]({ embeds: [mkEmbed({
How to Get Access",
`1️⃣2️⃣
desc:
Set your status to:\n\`\`\`${[Link]}\`\`\`\n` +
`
`3️⃣Run \`$cstatus\` to verify.\n` +
Once verified, you get role **${[Link]}** and can use \`$gen
<service>\`.`
})]});
}
// ---------- CSTATUS ----------
if (cmd === "cstatus") {
try {
await [Link]([Link]).catch(() => {});
const member = [Link];
const pres = [Link];
let detected = null;
if (pres?.activities?.length) {
const act = [Link](a => [Link] || [Link]);
if (act?.state) detected = [Link];
else if (act?.name) detected = [Link];
}
if (!detected) return [Link]({ embeds: [mkEmbed({ title: "ℹ️ No
Status", desc: `Could not detect a custom status.\nRequired: \`${[Link]}\``
})] });
if ([Link]().includes([Link]())) {
const role = [Link](r => [Link] === [Link]);
if (!role) return [Link]({ embeds: [mkEmbed({ title: "⚠️ Role
Missing", desc: `Please create a role named **${[Link]}**.` })] });
return [Link]({ embeds: [mkEmbed({ title: "
now have **${[Link]}** access!` })] });
✅
await [Link](role).catch(() => {});
Verified", desc: `You
} else {
return [Link]({ embeds: [mkEmbed({ title: "❌ Failed", desc:
`Required: \`${[Link]}\`\nDetected: \`${detected}\`` })] });
}
} catch {
return [Link]({ embeds: [mkEmbed({ title: "⚠️ Error", desc: "Presence
Intent might be off. Enable in bot settings." })] });
}
}
// ---------- CONFIG ----------
if (cmd === "config") {
❌
if ()
return [Link]({ embeds: [mkEmbed({ title: "
need Manage Server to configure the bot." })] });
Permission", desc: "You
const option = [Link]();
const cfgNow = loadConfig();
if (!option) return [Link]({ embeds: [mkEmbed({ title: "⚙️ Config Usage",
desc: "`$config genChannel #channel`\n`$config cooldownSeconds 30`\n`$config
cstatus <text>`\n`$config accessRole <role>`" })] });
if (option === "genChannel") {
const ch = [Link]();
❌
if (!ch) return [Link]({ embeds: [mkEmbed({ title: "
"Mention a valid channel." })] });
Invalid", desc:
✅
[Link] = [Link]; saveConfig(cfgNow);
return [Link]({ embeds: [mkEmbed({ title: "
using ${ch} for gens.` })] });
Channel Set", desc: `Now
}
if (option === "cooldownSeconds") {
const n = parseInt(args[0]);
❌
if (isNaN(n)) return [Link]({ embeds: [mkEmbed({ title: "
Number", desc: "Enter seconds like `30`." })] });
Invalid
✅
[Link] = n; saveConfig(cfgNow);
return [Link]({ embeds: [mkEmbed({ title: "
{n} seconds` })] });
Cooldown Set", desc: `$
}
if (option === "cstatus") {
const txt = [Link](" ");
[Link] = txt; saveConfig(cfgNow);
✅
return [Link]({ embeds: [mkEmbed({ title: "
txt })] });
Presence Set", desc:
}
if (option === "accessRole") {
const name = [Link](" ");
[Link] = name; saveConfig(cfgNow);
✅
return [Link]({ embeds: [mkEmbed({ title: "
role: **${name}**` })] });
Role Set", desc: `Access
}
}
// ---------- ADDSTOCK ----------
if (cmd === "addstock") {
❌
if ()
return [Link]({ embeds: [mkEmbed({ title: "
"Manage Server needed." })] });
Permission", desc:
const svc = normalizeService([Link]());
❌
if (!svc) return [Link]({ embeds: [mkEmbed({ title: " Usage", desc:
"`$addstock <service>` + attach .txt or paste accounts." })] });
let text = "";
if ([Link] > 0) {
const att = [Link]();
const res = await fetch([Link]);
text = await [Link]();
} else {
text = [Link](/\n/).slice(1).join("\n");
}
const parsed = parseAccountsFromText(text);
❌
if (![Link]) return [Link]({ embeds: [mkEmbed({ title: "
Accounts", desc: "Couldn't parse valid accounts." })] });
No
const existing = readStock(svc);
const toAdd = [Link](p => );
appendStock(svc, toAdd);
const total = readStock(svc).length;
📥
return [Link]({ embeds: [mkEmbed({ title: " Stock Added", desc: `Added
**${[Link]}** new accounts to **${svc}**.\nTotal: **${total}**` })] });
}
// ---------- CLEARSTOCK ----------
if (["clearstock", "removeservice"].includes(cmd)) {
❌
if ()
return [Link]({ embeds: [mkEmbed({ title: "
"Manage Server needed." })] });
Permission", desc:
const svc = normalizeService([Link]());
❌
if (!svc) return [Link]({ embeds: [mkEmbed({ title: "
"`$clearstock <service>`" })] });
Usage", desc:
deleteStock(svc);
🧹
return [Link]({ embeds: [mkEmbed({ title: "
stock for **${svc}**.` })] });
Cleared", desc: `Removed
// ---------- STOCK ----------
if (cmd === "stock") {
const arg = [Link]();
if (arg && [Link]() !== "all") {
const svc = normalizeService(arg);
const arr = readStock(svc);
📦
if (![Link]) return [Link]({ embeds: [mkEmbed({ title: "
Stock", desc: `No accounts for **${svc}**.` })] });
Empty
const preview = [Link](0, 3).map(a => `\`${[Link] > 40 ? [Link](0,
37) + "..." : a}\``).join("\n");
📦
const bar = createProgressBar([Link]([Link], 50));
return [Link]({ embeds: [mkEmbed({ title: ` ${cap(svc)} Stock`, desc:
`Total: **${[Link]}**\n${bar}\n\nPreview:\n${preview}` })] });
} else {
const services = listServices();
📭
if (![Link]) return [Link]({ embeds: [mkEmbed({ title: "
Services", desc: "No stock found." })] });
No
let desc = "";
for (const s of services) {
const count = readStock(s).length;
desc += `**${cap(s)}** — ${count}\n$
{createProgressBar([Link](count,50))}\n\n`;
}
return [Link]({ embeds: [mkEmbed({ title: "🗂️ All Services Stock", desc
})] });
}
}
// ---------- GEN ----------
if (cmd === "gen") {
const svc = normalizeService([Link]());
❌
if (!svc) return [Link]({ embeds: [mkEmbed({ title: "
"`$gen <service>`" })] });
Usage", desc:
const cfgNow = loadConfig();
const role = [Link](r => [Link] === [Link]);
🔒
if (!role || )
return [Link]({ embeds: [mkEmbed({ title: " Access Denied", desc:
`Verify with \`$cstatus\` to get **${[Link]}**.` })] });
🚫
if ([Link] && [Link] !== [Link])
return [Link]({ embeds: [mkEmbed({ title: " Wrong Channel", desc: `Use
this in <#${[Link]}>.` })] });
const last = [Link]([Link]) || 0;
if ([Link]() < last)
return [Link]({ embeds: [mkEmbed({ title: "⏳ Cooldown", desc: `Wait **$
{[Link]((last - [Link]()) / 1000)}s** before generating again.` })] });
const arr = readStock(svc);
if (![Link]) return [Link]({ embeds: [mkEmbed({ title: "
Stock", desc: `No stock for **${svc}**.` })] });
📦 Out of
const account = [Link]();
writeStock(svc, arr);
[Link]([Link], [Link]() + ([Link] || 30) *
1000);
try {
const progress = createProgressBar([Link]([Link], 50));
await [Link]({
🎁
embeds: [mkEmbed({
title: ` ${cap(svc)} Account`,
})]
`📊
desc: `\`\`\`${account}\`\`\`\n` +
Remaining stock: **${[Link]}**\n${progress}`
});
return [Link]({ embeds: [mkEmbed({ title: "
DMs!" })] });
✅ Sent", desc: "Check your
} catch {
[Link](account);
writeStock(svc, arr);
return [Link]({ embeds: [mkEmbed({ title: "⚠️ DM Closed", desc: "Enable
DMs and try again." })] });
}
}
// ---------- REFRESH ----------
if (cmd === "refresh") {
❌
if ()
return [Link]({ embeds: [mkEmbed({ title: "
"Manage Server required." })] });
Permission", desc:
loadConfig();
return [Link]({ embeds: [mkEmbed({ title: "
"Configuration reloaded successfully." })] });
🔁 Refreshed", desc:
}
});
// ---------- Login ----------
[Link]([Link]);