jenil0349

Create a highly professional, enterprise-grade Discord Review Bot for my hosting server "HexaClouds" using Discord.js v14 and Node.js v18+. The bot must feature zero AI dependencies and be fully controllable directly from Discord via slash commands.

🌟 1. One-Command Setup (/setup-review)

  • Must be Administrator-only.
  • Allows selecting the review channel (#reviews) and optional log channel (#review-logs).
  • Automatically sends an ultra-clean, persistent Embed with a "⭐ Submit Review" button into the configured channel.

📝 2. Interactive Review Flow (Discord Modals)

  • Clicking "⭐ Submit Review" opens a sleek Discord Modal with 3 fields:

- Rating: 1 to 5 stars dropdown/input. - Service Used: (e.g., Minecraft Hosting, VPS Hosting, Bot Hosting, Domain/Web). - Your Review: Detailed text feedback.

💎 3. Premium Review Card & Canvas Styling

  • Dynamic Star Embed: Displays star visuals (⭐⭐⭐⭐⭐), reviewer avatar & mention, selected service tag, quoted feedback (> ...), and exact timestamp.
  • Dynamic Canvas Banner: When a 5-star review drops, automatically generate a custom visual flex graphic card using canvas featuring the user's avatar, star rating, and "HexaClouds Verified Client" badge, posted directly in the review channel.
  • Reactions & Interactions: Automatically adds reaction emojis (👍, 💖, 💯) to every review card.

🎁 4. Automated Perks & Coupons

  • Role Rewards: Automatically assigns a "Verified Client" or "HexaClouds Supporter" role when a 4 or 5-star review is submitted.
  • Discount Code Generator: Automatically DMs the user a unique one-time discount coupon (e.g., HEXA-REV-XXXX) for a percentage off their next HexaClouds hosting renewal.

🛠️ 5. Staff Management, Webhooks & Moderation

  • Staff Reply System (/reply-review <review_id> <message>): Allows staff to reply directly to a specific user's review with a threaded response.
  • Instant Webhook Alerts: Sends rich webhook notifications to a private staff channel. Pings @Admin or @Support Manager instantly if a negative review (1-2 stars) is dropped.
  • Anti-Spam & Admin Tools: 24-hour user cooldown, bad-word filter, and /delete-review <review_id>.
  • Data Export (/export-reviews): Admin-only command to download all database reviews as a clean .csv or .json backup file.

📊 6. Analytics & Live Public Stats

  • Star Leaderboard (/setup-leaderboard): A live pinned message showing top services, total reviews, and overall company rating score.
  • Voice Channel Counters (/setup-vc-stats): Automatically creates and updates Discord Voice Channel stats displaying metrics like ⭐ Rating: 4.9/5.0 and 📝 Total Reviews.

🎛️ 7. In-Discord Customization & Configuration (/config)

Allow admins to customize the bot live without touching code or restarting:

  • /config set-channel <type> <channel> (reviews, logs, leaderboard)
  • /config set-role <tier> <role> (verified_client, supporter)
  • /config set-color <hex_code> (change main embed accent color on the fly)
  • /config toggle <feature> (enable/disable dm_coupon, canvas_banner, anti_spam dynamically)
  • /config view (displays current active settings panel)

🗄️ 8. Data Storage & Deliverables

  • Use SQLite / Quick.db / JSON database to securely persist reviews, user cooldowns, and bot configuration settings.
  • Provide complete production-ready source code structure (handlers/, commands/, utils/), a package.json file, and a clear setup guide for Pterodactyl Panel / VPS.
Kodari AI
KodariNov 7 at 6:16 am 1
HexaCloudsReviewBot
Enterprise-grade Discord review management bot for HexaClouds hosting. Features slash-command setup, interactive modal review submissions with star ratings, dynamic Canvas-generated 5-star flex cards, automatic role rewards and unique discount coupons, staff reply system, webhook alerts for negative reviews, anti-spam cooldowns, bad-word filtering, live analytics leaderboards, voice channel stat counters, and in-Discord configuration panel. SQLite persistence, full moderation tools, CSV/JSON export, and production-ready structure for Pterodactyl deployment.
  1. Create the Discord.js v14 bot entry point, dependencies, and environment template.

  2. Add persistent SQLite storage, review modal flow, rewards, moderation, webhook alerts, and Canvas banners.

  3. Implement staff/admin commands, leaderboard and voice stats, plus live /config controls.

  4. Document setup and deployment, including Pterodactyl compatibility.

Created the HexaClouds Discord.js v14 review bot with persistent SQLite storage, slash-command setup and moderation, review modals, staff alerts, rewards, exports, live stats, and optional five-star Canvas banners. Setup and Pterodactyl deployment instructions are in README.md; the bot needs only the Guilds intent.

Coupon codes are generated and stored uniquely, but redeeming them against a hosting billing system requires a separate redemption process.

Kodari can make mistakes. Review important code before using.
Files
commands
handlers
utils
bot.js
package.json
README.md
Code
17 896
bot.js
require('dotenv').config();

const fs = require('node:fs');
const path = require('node:path');
const { Client, Collection, Events, GatewayIntentBits } = require('discord.js');
const { refreshLeaderboard, refreshVoiceStats } = require('./utils/statistics');

if (!process.env.DISCORD_TOKEN) {
  console.error('DISCORD_TOKEN is missing. Copy .env.example to .env and add your bot token.');
  process.exit(1);
}

const client = new Client({ intents: [GatewayIntentBits.Guilds] });
client.commands = new Collection();

const commandsPath = path.join(__dirname, 'commands');
for (const file of fs.readdirSync(commandsPath).filter((entry) => entry.endsWith('.js'))) {
  const command = require(path.join(commandsPath, file));
  client.commands.set(command.data.name, command);
}

client.once(Events.ClientReady, async (readyClient) => {
  try {
    await readyClient.application.commands.set(
      [...client.commands.values()].map((command) => command.data.toJSON())
    );
    console.log(`Logged in as ${readyClient.user.tag}`);
    console.log('KODARI_READY');

    for (const guild of readyClient.guilds.cache.values()) {
      await refreshLeaderboard(client, guild.id).catch((error) => console.error('Leaderboard refresh failed:', error));
      await refreshVoiceStats(client, guild.id).catch((error) => console.error('Voice stats refresh failed:', error));
    }
  } catch (error) {
    console.error('Failed to register application commands:', error);
  }
});

client.on(Events.InteractionCreate, async (interaction) => {
  try {
    if (interaction.isChatInputCommand()) {
      const command = client.commands.get(interaction.commandName);
      if (command) await command.execute(interaction, client);
      return;
    }

    if (interaction.isButton() && interaction.customId === 'review:submit') {
      const { showReviewModal } = require('./handlers/reviewFlow');
      await showReviewModal(interaction);
      return;
    }

    if (interaction.isModalSubmit() && interaction.customId === 'review:submit-modal') {
      const { handleReviewSubmission } = require('./handlers/reviewFlow');
      await handleReviewSubmission(interaction, client);
    }
  } catch (error) {
    console.error('Interaction failed:', error);
    const response = { content: 'Something went wrong while handling that interaction. Please try again later.', ephemeral: true };
    if (interaction.deferred || interaction.replied) {
      await interaction.followUp(response).catch(() => {});
    } else {
      await interaction.reply(response).catch(() => {});
    }
  }
});

client.on(Events.Error, (error) => console.error('Discord client error:', error));
process.on('unhandledRejection', (error) => console.error('Unhandled promise rejection:', error));
process.on('uncaughtException', (error) => {
  console.error('Uncaught exception:', error);
  process.exit(1);
});

setInterval(async () => {
  for (const guild of client.guilds.cache.values()) {
    await refreshVoiceStats(client, guild.id).catch((error) => console.error('Voice stats refresh failed:', error));
  }
}, 10 * 60 * 1000).unref();

client.login(process.env.DISCORD_TOKEN);