M
📎 1 file 2,788 chars
📄
pasted-code-1777751066680.txt
txt 149 lines
▶
STWORZ PROFESJONALNEGO BOTA DISCORD (NODE.JS + DISCORD.JS V14)

⚠️ WAZNE:
CALY SYSTEM BEZ POLSKICH ZNAKOW (BRAK: ą ć ę ł ń ó ś ź ż)
UZYWAJ TYLKO ASCII + SMALL CAPS UNICODE

WSZYSTKIE TEKSTY W STYLU MALEJ KAPITALKI:

* ᴡɪᴛᴀᴊ
* ᴘᴀɴᴇʟ
* ᴛɪᴄᴋᴇᴛ
* ɴᴀɢʀᴏᴅʏ

# ZASADA DZIALANIA

Bot NIE odpowiada zwykla wiadomoscia.
WSZYSTKIE INTERAKCJE MAJA BYC EPHEMERAL (reply interaction / ephemeral response).
Kazda akcja to response na interaction, nie normal message.

---

# PANEL TICKETOW

Komenda:
/setup

Bot wysyla embed (NIE normalna wiadomosc, tylko interaction reply lub channel message z UI):

OBRAZEK:
panel.jpg

# GORNY TYTUL EMBEDA:

ᴄᴇɴᴛʀᴜᴍ ᴘᴏᴍᴏᴄʏ

# OPIS EMBEDA:

ᴘᴏᴛʀᴢᴇʙᴜᴊᴇsᴢ ᴘᴏᴍᴏᴄʏ?
ᴡʏʙɪᴇʀ ᴋᴀᴛᴇɢᴏʀɪᴇ ᴘᴏɴɪᴢᴇᴊ ɪ ᴏᴛᴡᴏʀᴢ ᴛɪᴄᴋᴇᴛ

---

# SELECT MENU (KATEGORIE)

🆘 ᴘᴏᴍᴏᴄ ɢʟᴏᴡɴᴀ - pytania i pomoc
🔐 ᴋᴏɴᴛᴏ - problemy z kontem
🚨 ᴢɢʟᴏsᴢᴇɴɪᴇ - report gracza
💾 ʙᴀᴄᴋᴜᴘ - dane i odzyskiwanie
📋 ʀᴇᴋʀᴜᴛᴀᴄᴊᴀ - dolaczenie do teamu
💎 ᴠɪᴘ - sprawy premium
🎁 ɴᴀɢʀᴏᴅʏ - odbior nagrod
🧧 ᴏᴅʙɪᴏʀ ɴᴀɢʀᴏᴅʏ - problemy z nagrodami

---

# TWORZENIE TICKETA

Po kliknieciu kategorii bot tworzy kanal ticket:

Kanał prywatny:

* user + staff only
* limit 2 tickety na usera

---

# EMBED W TICKECIE (START)

const embed = new EmbedBuilder()
  .setTitle("ᴛɪᴄᴋᴇᴛ ᴢᴏsᴛᴀʟ ᴜᴛᴡᴏʀᴢᴏɴʏ")
  .setDescription(
`📌 ᴋᴀᴛᴇɢᴏʀɪᴀ: **${type}**

━━━━━━━━━━━━━━━━━━━━━━
📜 ɪɴᴋᴛʀᴜᴋᴄᴊᴇ:
━━━━━━━━━━━━━━━━━━━━━━

* opisz swój problem dokładnie
* NIE SPAMUJ WIADOMOŚCIAMI
* czekaj cierpliwie na odpowiedź
* możesz dołączyć screeny

━━━━━━━━━━━━━━━━━━━━━━
⏳ ᴘʀᴢᴇᴅ ᴢᴀᴍᴋɴɪᴇᴄɪᴇᴍ:
━━━━━━━━━━━━━━━━━━━━━━

* upewnij się, że problem został rozwiązany
* kliknij 🔒 zamknij aby zakończyć ticket`
  )
  .setColor(colors[type] || "#5865F2")
  .setFooter({ text: "Support wkrótce odpowie" })
  .setImage("attachment://piesek.jpg");

---

# TEKST WITAJACY W TICKECIE

ᴡɪᴛᴀᴊ, @nick
ᴛᴡᴏᴊ ᴛɪᴄᴋᴇᴛ ᴢᴏsᴛᴀʟ ᴜᴛᴡᴏʀᴢᴏɴʏ
ᴢᴀᴄᴢɴɪᴊ ᴏᴘɪsʏᴡᴀᴄ ᴘʀᴏʙʟᴇᴍ

---

# PRZYCISKI W TICKECIE

🔒 ᴢᴀᴍᴋɴɪᴊ
👤 ᴅᴏᴅᴀᴊ (osoba która przejela może dodac osobe która też może pisać)
📌 ᴘʀᴢᴇᴊᴍɪᴊ (tylko osoba które przejela oraz osoba która stworzyla mogą pisać)

---

# STYLE UX

* kazdy embed premium
* kolory ciemne / neon
* footer + timestamp
* emoji przy kazdej sekcji
* bardzo czysty UI
* "lore" system (estetyczny klimat serwera)

---

# ZASADA DZIALANIA BOT

* brak z reply wiadomosci
* ephemeral gdzie mozliwe
* brak spamu tekstowego
* wszystko estetyczne UI

---

# WYMAGANIA KODU

* discord.js v14
* slash commands
* event handler architecture
* commands folder
* cooldown system (in-memory)
* brak bazy danych
* czysty kod
* brak crashy
* error handling

---

# FINAL

Wygeneruj CALY GOTOWY PROJEKT BOTA DISCORD Z TYM SYSTEMEM
Kodari AI
KodariMay 2 at 7:47 pm 14,585 (v2)

I’ll create a professional Discord ticket bot with ephemeral interactions and small caps Unicode styling.

DiscordTicketBot
A professional Discord ticket system with ephemeral interactions, small caps Unicode styling, and category-based support channels. Features include ticket creation with select menus, staff management, ticket claiming system, and user-friendly UI with premium embeds. No database required - all data managed in-memory.

Creating a complete Discord.js v14 ticket bot with event handler architecture, ephemeral responses, and premium UI:


Bot created successfully!

Complete ticket system with:

  • /setup command creates ticket panel with 8 categories

  • Ephemeral interactions throughout

  • Small caps Unicode styling (ᴛɪᴄᴋᴇᴛ sʏsᴛᴇᴍ)

  • Ticket claiming, user adding, and closing

  • In-memory storage (no database)

  • Event handler architecture with cooldowns

  • Premium embeds with custom colors

Next steps:

  1. Run npm install

  2. Fill .env with your bot token and IDs

  3. Enable intents in Discord Developer Portal

  4. Run npm start

  5. Use /setup in your server

M

pisz tylko w index.js

Kodari AI
KodariMay 2 at 8:03 pm 18,637 (v2)

I’ll consolidate everything into a single index.js file.


Gotowe! Cały bot w jednym pliku index.js:

✅ Wszystko w /setup komendzie
✅ Ephemeral responses
✅ Small caps Unicode (ᴛɪᴄᴋᴇᴛ, ᴘᴀɴᴇʟ, ɴᴀɢʀᴏᴅʏ)
✅ 8 kategorii ticketów
✅ System claim/add/close
✅ Limit 2 tickety na usera
✅ Cooldown system
✅ Error handling
✅ In-memory storage (brak DB)

Wypełnij .env danymi i uruchom npm start!

M

// ===== CONFIG ===== const TOKEN = "TOKEN"; const CLIENT_ID = "1492839109037920427"; const GUILD_ID = "1264335386537099265"; const SUPPORT_ROLE_ID = "1421880497138569387";

const colors = { "Pomoc": "#3498db", "Hasło": "#f1c40f", "Cheater": "#e74c3c", "Backup": "#9b59b6", "Rekrutacja": "#2ecc71" };

ᴡꜱᴢʏꜱᴛᴋᴏ ᴄᴏ ꜱɪᴇ ᴅᴀ ᴡ ᴋᴀᴘɪᴛᴀʟᴄᴇ

oraz podpisuj gdzie co mam wpiac np TOKEN

dodaj też ingeracje chatu z mc->dc i dc->mc na kanale z tym id 1492987160893329489 ale aby role z luckyperms tez lapalo

Kodari AI
KodariMay 2 at 8:14 pm 27,058 (v2)

✅ Gotowe! Cały bot w jednym pliku index.js

Co zostało dodane:

  1. ✅ Komentarze gdzie wkleić wartości (TOKEN, IDs, RCON config)

  2. ✅ Więcej small caps (ᴡɪᴛᴀᴊ, ᴘᴀɴᴇʟ, ᴛɪᴄᴋᴇᴛ, ɴᴀɢʀᴏᴅʏ etc)

  3. ✅ MC <-> DC chat bridge na kanale 1492987160893329489

  4. ✅ LuckyPerms prefix support - webhook odbiera prefix i wyświetla

  5. ✅ RCON integration - wysyła wiadomości do MC przez tellraw

  6. ✅ Express webhook server - odbiera wiadomości z MC

  7. ✅ Gotowe komendy RCON z kolorowym formatowaniem

Jak to działa:

  • Wiadomość na DC → wysyłana do MC przez RCON (tellraw)

  • Plugin MC → wysyła POST na /minecraft-chat z {player, message, prefix}

  • Bot formatuje z prefiksem LuckyPerms i wysyła na DC

Setup MC plugin: Musisz stworzyć prosty plugin który wysyła POST request:

Plain Text
POST http://twoj-bot-ip:3000/minecraft-chat
{
  "player": "gracz",
  "message": "wiadomosc", 
  "prefix": "[Admin]"  // z LuckyPerms
}

Uruchom npm install i npm start! 🚀

Kodari can make mistakes. Review important code before using.
Files
commands
events
.gitignore
config.json
index.js
package.json
README.md
Code
8 1,152
index.js
// ==============================================================
// 🎫 DISCORD TICKET BOT + MINECRAFT CHAT BRIDGE
// ==============================================================

const { Client, GatewayIntentBits, Collection, EmbedBuilder, ActionRowBuilder, StringSelectMenuBuilder, ButtonBuilder, ButtonStyle, SlashCommandBuilder, REST, Routes, PermissionFlagsBits, ChannelType, WebhookClient } = require('discord.js');
const express = require('express');
const { Rcon } = require('rcon-client');

// ======================= CONFIG =======================
// WKLEJ SWOJE WARTOSCI PONIZEJ:

const TOKEN = "TOKEN";                                    // ← WKLEJ TOKEN BOTA
const CLIENT_ID = "1492839109037920427";                  // ← ID APLIKACJI BOTA
const GUILD_ID = "1264335386537099265";                   // ← ID SERWERA DISCORD
const SUPPORT_ROLE_ID = "1421880497138569387";            // ← ID ROLI SUPPORT
const CHAT_CHANNEL_ID = "1492987160893329489";            // ← ID KANALU CHAT MC<->DC

// MINECRAFT RCON CONFIG
const MC_RCON_HOST = "localhost";                         // ← IP SERWERA MC
const MC_RCON_PORT = 25575;                               // ← PORT RCON (domyslnie 25575)
const MC_RCON_PASSWORD = "your_rcon_password";            // ← HASLO RCON Z server.properties

// WEBHOOK SERVER PORT (do odbierania wiadomosci z MC)
const WEBHOOK_PORT = 3000;                                // ← PORT SERWERA WEBHOOK

// ======================================================

const config = require('./config.json');

const client = new Client({
    intents: [
        GatewayIntentBits.Guilds,
        GatewayIntentBits.GuildMessages,
        GatewayIntentBits.MessageContent,
        GatewayIntentBits.GuildMembers
    ]
});

client.cooldowns = new Collection();
client.activeTickets = new Map();

// RCON Connection
let rconClient = null;

// Express server for MC webhooks
const app = express();
app.use(express.json());

// ==================== READY EVENT ====================
client.once('ready', async () => {
    console.log(`✅ ʙᴏᴛ ᴊᴇsᴛ ɢᴏᴛᴏᴡʏ! ${client.user.tag}`);
    
    // Connect to MC RCON
    try {
        rconClient = await Rcon.connect({
            host: MC_RCON_HOST,
            port: MC_RCON_PORT,
            password: MC_RCON_PASSWORD
        });
        console.log('✅ ᴘᴏʟᴀᴄᴢᴏɴᴏ ᴢ ᴍɪɴᴇᴄʀᴀғᴛ ʀᴄᴏɴ');
    } catch (error) {
        console.error('❌ ʙʟᴀᴅ ᴘᴏʟᴀᴄᴢᴇɴɪᴀ ʀᴄᴏɴ:', error.message);
    }
    
    const commands = [
        new SlashCommandBuilder()
            .setName('setup')
            .setDescription('sᴇᴛᴜᴘ ᴛɪᴄᴋᴇᴛ ᴘᴀɴᴇʟ')
            .setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
    ];

    const rest = new REST({ version: '10' }).setToken(TOKEN);

    try {
        console.log('🔄 ʀᴇᴊᴇsᴛʀᴀᴄᴊᴀ ᴋᴏᴍᴇɴᴅ...');

        await rest.put(
            Routes.applicationGuildCommands(CLIENT_ID, GUILD_ID),
            { body: commands }
        );

        console.log('✅ ᴋᴏᴍᴇɴᴅʏ ᴢᴀʀᴇᴊᴇsᴛʀᴏᴡᴀɴᴇ');
    } catch (error) {
        console.error('❌ ʙʟᴀᴅ ʀᴇᴊᴇsᴛʀᴀᴄᴊɪ ᴋᴏᴍᴇɴᴅ:', error);
    }

    client.user.setActivity('ᴛɪᴄᴋᴇᴛ sʏsᴛᴇᴍ 🎫', { type: 3 });
});

// ==================== INTERACTION CREATE EVENT ====================
client.on('interactionCreate', async (interaction) => {
    if (interaction.isChatInputCommand()) {
        if (interaction.commandName === 'setup') {
            await handleSetupCommand(interaction);
        }
    } else if (interaction.isStringSelectMenu()) {
        if (interaction.customId === 'ticket_category') {
            await handleTicketCreation(interaction);
        }
    } else if (interaction.isButton()) {
        if (interaction.customId === 'close_ticket') {
            await handleCloseTicket(interaction);
        } else if (interaction.customId === 'claim_ticket') {
            await handleClaimTicket(interaction);
        } else if (interaction.customId === 'add_user') {
            await handleAddUser(interaction);
        }
    }
});

// ==================== MC <-> DC CHAT BRIDGE ====================

// DC -> MC
client.on('messageCreate', async (message) => {
    if (message.author.bot) return;
    if (message.channel.id !== CHAT_CHANNEL_ID) return;

    const username = message.member?.displayName || message.author.username;
    const content = message.content;

    if (!rconClient) {
        console.error('❌ ʀᴄᴏɴ ɴɪᴇ ᴘᴏʟᴀᴄᴢᴏɴʏ');
        return;
    }

    try {
        // Escape quotes in message
        const escaped = content.replace(/"/g, '\\"');
        
        // Send to MC using tellraw
        const command = `tellraw @a ["",{"text":"[","color":"dark_gray"},{"text":"DC","color":"#5865F2","bold":true},{"text":"] ","color":"dark_gray"},{"text":"${username}","color":"white"},{"text":": ","color":"gray"},{"text":"${escaped}","color":"white"}]`;
        
        await rconClient.send(command);
    } catch (error) {
        console.error('❌ ʙʟᴀᴅ ᴡʏsʏʟᴀɴɪᴀ ᴅᴏ ᴍᴄ:', error.message);
    }
});

// MC -> DC (webhook endpoint)
app.post('/minecraft-chat', async (req, res) => {
    try {
        const { player, message, prefix } = req.body;

        if (!player || !message) {
            return res.status(400).json({ error: 'ʙʀᴀᴋ ᴅᴀɴʏᴄʜ' });
        }

        const channel = client.channels.cache.get(CHAT_CHANNEL_ID);
        if (!channel) {
            return res.status(404).json({ error: 'ᴋᴀɴᴀʟ ɴɪᴇ ᴢɴᴀʟᴇᴢɪᴏɴʏ' });
        }

        // Format message with LuckyPerms prefix if available
        let formattedMessage;
        if (prefix) {
            formattedMessage = `**[MC]** ${prefix} **${player}**: ${message}`;
        } else {
            formattedMessage = `**[MC]** **${player}**: ${message}`;
        }

        await channel.send(formattedMessage);
        res.status(200).json({ success: true });

    } catch (error) {
        console.error('❌ ʙʟᴀᴅ ᴡᴇʙʜᴏᴏᴋᴀ:', error);
        res.status(500).json({ error: 'ʙʟᴀᴅ sᴇʀᴡᴇʀᴀ' });
    }
});

// Start webhook server
app.listen(WEBHOOK_PORT, () => {
    console.log(`✅ ᴡᴇʙʜᴏᴏᴋ sᴇʀᴡᴇʀ: ᴘᴏʀᴛ ${WEBHOOK_PORT}`);
});

// ==================== SETUP COMMAND ====================
async function handleSetupCommand(interaction) {
    const { cooldowns } = client;
    const cooldownKey = 'setup';
    
    if (!cooldowns.has(cooldownKey)) {
        cooldowns.set(cooldownKey, new Map());
    }

    const now = Date.now();
    const timestamps = cooldowns.get(cooldownKey);
    const cooldownAmount = 5 * 1000;

    if (timestamps.has(interaction.user.id)) {
        const expirationTime = timestamps.get(interaction.user.id) + cooldownAmount;

        if (now < expirationTime) {
            const timeLeft = (expirationTime - now) / 1000;
            return interaction.reply({
                content: `⏰ ᴘᴏᴄᴢᴇᴋᴀᴊ ${timeLeft.toFixed(1)}s ᴘʀᴢᴇᴅ ᴜᴢʏᴄɪᴇᴍ ᴛᴇᴊ ᴋᴏᴍᴇɴᴅʏ`,
                ephemeral: true
            });
        }
    }

    timestamps.set(interaction.user.id, now);