26.0-build-1
This commit is contained in:
1 parent
4af9759700
commit
9448c4e3d6
20 files changed
+4052
-2098
No files matched your search
+462
-278
File diff suppressed because it is too large.
Load diff
+69
-71
@@ -2,14 +2,9 @@ const fs = require("fs");
|
||||
const Discord = require("discord.js");
|
||||
const yaml = require("js-yaml");
|
||||
const Event = require("../Structures/Event.js");
|
||||
const gradient = require("gradient-string");
|
||||
const figlet = require("figlet");
|
||||
|
||||
// Load configs
|
||||
const supportbot = yaml.load(fs.readFileSync("./Configs/supportbot.yml", "utf8"));
|
||||
const panel = yaml.load(fs.readFileSync("./Configs/ticket-panel.yml", "utf8"));
|
||||
const cmdconfig = yaml.load(fs.readFileSync("./Configs/commands.yml", "utf8"));
|
||||
const msgconfig = yaml.load(fs.readFileSync("./Configs/messages.yml", "utf8"));
|
||||
|
||||
const ACTIVITY_TYPES = {
|
||||
PLAYING: Discord.ActivityType.Playing,
|
||||
@@ -20,65 +15,76 @@ const ACTIVITY_TYPES = {
|
||||
|
||||
const setActivity = (client, type, status) => {
|
||||
const activityType = ACTIVITY_TYPES[type?.toUpperCase()];
|
||||
if (activityType) {
|
||||
client.user.setPresence({
|
||||
activities: [{ name: status || "Online", type: activityType }],
|
||||
status: type?.toLowerCase() || "online"
|
||||
});
|
||||
}
|
||||
if (!activityType) return;
|
||||
|
||||
client.user.setPresence({
|
||||
activities: [{ name: status || "Online", type: activityType }],
|
||||
status: "online"
|
||||
});
|
||||
};
|
||||
|
||||
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
||||
// simple colors
|
||||
const c = {
|
||||
reset: "\x1b[0m",
|
||||
gray: "\x1b[90m",
|
||||
green: "\x1b[32m",
|
||||
yellow: "\x1b[33m",
|
||||
cyan: "\x1b[36m",
|
||||
bold: "\x1b[1m"
|
||||
};
|
||||
|
||||
function line() {
|
||||
console.log(`${c.gray}────────────────────────────────────────────────────────${c.reset}`);
|
||||
}
|
||||
|
||||
function section(title) {
|
||||
console.log(`\n${c.green}${title}${c.reset}`);
|
||||
console.log(`${c.gray}${"-".repeat(title.length)}${c.reset}`);
|
||||
}
|
||||
|
||||
function info(label, value) {
|
||||
console.log(`${c.gray}${label.padEnd(14)}${c.reset} ${value}`);
|
||||
}
|
||||
|
||||
function status(label, ok, details = "") {
|
||||
const icon = ok ? `${c.green}✓${c.reset}` : `${c.yellow}!${c.reset}`;
|
||||
console.log(` ${icon} ${label}${details ? ` (${details})` : ""}`);
|
||||
}
|
||||
|
||||
const logStartup = async (client) => {
|
||||
console.clear();
|
||||
|
||||
// Animated loading
|
||||
const frames = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
|
||||
for (let i = 0; i < frames.length * 2; i++) {
|
||||
process.stdout.write(`\r${frames[i % frames.length]} Initializing SupportBot...`);
|
||||
await sleep(100);
|
||||
}
|
||||
console.clear();
|
||||
|
||||
// Main title
|
||||
console.log("\n" + gradient.pastel.multiline(figlet.textSync("SupportBot", { font: "ANSI Shadow", horizontalLayout: "fitted" })));
|
||||
|
||||
// Extract bot details safely
|
||||
const botName = supportbot?.General?.Name || "SupportBot";
|
||||
const botVersion = supportbot.SupportBot_Version;
|
||||
const botVersion = supportbot?.SupportBot_Version || "Unknown";
|
||||
|
||||
console.log("\n╔═══════════════════════════════════════════════════════════════╗");
|
||||
console.log("║ System Information ║");
|
||||
console.log("╠═══════════════════════════════════════════════════════════════╣");
|
||||
console.log(`║ Bot Name : ${botName.padEnd(45)} ║`);
|
||||
console.log(`║ Version : ${botVersion.padEnd(45)} ║`);
|
||||
console.log(`║ Node.js : ${process.version.padEnd(45)} ║`);
|
||||
console.log(`║ Discord.js : v${Discord.version.padEnd(44)} ║`);
|
||||
console.log("╚═══════════════════════════════════════════════════════════════╝\n");
|
||||
|
||||
// Links section
|
||||
console.log(gradient.summer("┏━━━━━━━━━━━━━━━━━━━ Important Links ━━━━━━━━━━━━━━━━━━━┓"));
|
||||
console.log(gradient.summer("┃ ┃"));
|
||||
console.log(gradient.summer("┃ ") + "📚 Docs : " + gradient.cristal("https://emerald-services.gitbook.io/ ┃"));
|
||||
console.log(gradient.summer("┃ ") + "🤝 Discord : " + gradient.cristal("https://dsc.gg/emerald-dev ┃"));
|
||||
console.log(gradient.summer("┃ ┃"));
|
||||
console.log(gradient.summer("┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛\n"));
|
||||
|
||||
// Bot Invite
|
||||
const inviteUrl = `https://discord.com/api/oauth2/authorize?client_id=${client.user.id}&permissions=8&scope=bot%20applications.commands`;
|
||||
console.log(gradient.teen("╔════════════════════════ Bot Invite ════════════════════════╗"));
|
||||
console.log(gradient.teen("║ ║"));
|
||||
console.log(gradient.teen("║ ") + gradient.pastel(inviteUrl.padEnd(56)) + gradient.teen("║"));
|
||||
console.log(gradient.teen("║ ║"));
|
||||
console.log(gradient.teen("╚════════════════════════════════════════════════════════════╝\n"));
|
||||
|
||||
line();
|
||||
console.log(`${c.bold}${c.green}SupportBot${c.reset}`);
|
||||
console.log(`${c.gray}Emerald Services${c.reset}`);
|
||||
line();
|
||||
|
||||
section("System");
|
||||
info("Bot Name", botName);
|
||||
info("Version", botVersion);
|
||||
info("Node.js", process.version);
|
||||
info("Discord.js", `v${Discord.version}`);
|
||||
info("Logged in as", client.user.tag);
|
||||
info("Guilds", `${client.guilds.cache.size}`);
|
||||
|
||||
section("Links");
|
||||
info("Docs", "https://emerald-services.gitbook.io/");
|
||||
info("Discord", "https://dsc.gg/emerald-dev");
|
||||
info("Invite", inviteUrl);
|
||||
|
||||
console.log("");
|
||||
};
|
||||
|
||||
const checkConfigs = async (client) => {
|
||||
const guild = client.guilds.cache.first();
|
||||
if (!guild) return;
|
||||
|
||||
console.log(gradient.morning("┏━━━━━━━━━━━━━━━━━━━━ Config Check ━━━━━━━━━━━━━━━━━━━━━┓"));
|
||||
section("Config Check");
|
||||
|
||||
const roles = [
|
||||
supportbot?.Roles?.StaffMember?.Admin,
|
||||
@@ -87,38 +93,30 @@ const checkConfigs = async (client) => {
|
||||
].filter(Boolean);
|
||||
|
||||
const channels = [
|
||||
supportbot?.Suggestions?.Channel,
|
||||
supportbot?.Ticket?.Log?.TicketLog,
|
||||
supportbot?.Ticket?.Log?.TranscriptLog,
|
||||
supportbot?.Ticket?.TicketHome,
|
||||
supportbot?.Welcome?.Channel,
|
||||
supportbot?.Leave?.Channel,
|
||||
supportbot?.Translate?.Log
|
||||
supportbot?.Ticket?.TicketHome
|
||||
].filter(Boolean);
|
||||
|
||||
const [missingRoles, missingChannels] = await Promise.all([
|
||||
const [roleResults, channelResults] = await Promise.all([
|
||||
Promise.all(roles.map((role) => client.getRole(role, guild))),
|
||||
Promise.all(channels.map((channel) => client.getChannel(channel, guild)))
|
||||
]);
|
||||
|
||||
const missing = {
|
||||
roles: roles.filter((_, i) => !missingRoles[i]),
|
||||
channels: channels.filter((_, i) => !missingChannels[i])
|
||||
};
|
||||
const missingRoles = roles.filter((_, i) => !roleResults[i]);
|
||||
const missingChannels = channels.filter((_, i) => !channelResults[i]);
|
||||
|
||||
if (missing.roles.length || missing.channels.length) {
|
||||
console.log(gradient.morning("┃ ⚠️ - Configuration Issues Found: ┃"));
|
||||
if (missing.roles.length) {
|
||||
console.log(gradient.morning("┃ • Missing Roles: ") + gradient.fruit(missing.roles.join(", ")));
|
||||
}
|
||||
if (missing.channels.length) {
|
||||
console.log(gradient.morning("┃ • Missing Channels: ") + gradient.fruit(missing.channels.join(", ")));
|
||||
}
|
||||
if (!missingRoles.length && !missingChannels.length) {
|
||||
status("All configurations validated successfully", true);
|
||||
} else {
|
||||
console.log(gradient.morning("┃ ✅ - All configurations validated successfully ┃"));
|
||||
if (missingRoles.length) {
|
||||
status("Missing roles", false, missingRoles.join(", "));
|
||||
}
|
||||
|
||||
if (missingChannels.length) {
|
||||
status("Missing channels", false, missingChannels.join(", "));
|
||||
}
|
||||
}
|
||||
|
||||
console.log(gradient.morning("┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛\n"));
|
||||
console.log("");
|
||||
};
|
||||
|
||||
module.exports = new Event("clientReady", async (client) => {
|
||||
|
||||
Reference in new issue
Block a user