dr689

Discord token <redacted>

📎 1 file 10,501 chars
📄
pasted-code-1778721456077.txt
txt 560 lines
▶
require("dotenv").config();

const {
  Client,
  GatewayIntentBits,
  PermissionsBitField,
  EmbedBuilder,
  ActionRowBuilder,
  StringSelectMenuBuilder
} = require("discord.js");

const Database = require("better-sqlite3");

/* ================= CLIENT ================= */

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

/* ================= DATABASE ================= */

const db = new Database("strikes.db");

db.prepare(`
CREATE TABLE IF NOT EXISTS strikes (
  userId TEXT PRIMARY KEY,
  strikes INTEGER
)
`).run();

/* ================= ROLE IDS ================= */

/* VERIFIED */
const VERIFIED_ROLE = "1500986196031963261";

/* STRIKES */
const STRIKE1_ROLE = "1500986196031963267";
const STRIKE2_ROLE = "1500986196031963266";
const STRIKE3_ROLE = "1500986196031963265";

/* DISCIPLINE */
const FIRED_ROLE = "1500986196031963264";
const BLACKLIST_ROLE = "1500986196044808392";

/* SECURITY WHITELIST */
const SECURITY_WL = "1500986196086624394";

/* COMMAND ROLES */
const COMMAND_ROLES = [
  "1500986196086624393", // SERV OWNER
  "1500986196086624392", // Executive Director
  "1500986196086624391", // Deputy Executive Director
  "1500986196086624389", // Executive Officer
  "1500986196073910363", // Senior Command
  "1500986196073910362", // Assistant Command
  "1500986196073910361"  // Command Staff
];

/* ================= LOG CHANNELS ================= */

const SECURITY_LOGS = "1500986196870959326";
const STRIKE_LOGS = "1500986196493467704";

/* ================= READY ================= */

client.once("ready", () => {

  console.log(`🛡️ ${client.user.tag} ONLINE`);

  client.user.setPresence({
    activities: [
      {
        name: "QGTM Security System",
        type: 3
      }
    ],
    status: "online"
  });

});

/* ================= ANTI RAID ================= */

let joins = [];

client.on("guildMemberAdd", async (member) => {

  joins.push(Date.now());

  joins = joins.filter(
    t => Date.now() - t < 10000
  );

  if (joins.length >= 5) {

    const embed = new EmbedBuilder()
      .setTitle("🚨 RAID DETECTED")
      .setDescription(
        "Automatic lockdown activated."
      )
      .setColor("Red");

    if (member.guild.systemChannel) {

      member.guild.systemChannel.send({
        embeds: [embed]
      });

    }

    member.guild.channels.cache.forEach(channel => {

      if (channel.isTextBased()) {

        channel.permissionOverwrites.edit(
          member.guild.roles.everyone,
          {
            SendMessages: false
          }
        ).catch(() => {});

      }

    });

    const log =
      member.guild.channels.cache.get(
        SECURITY_LOGS
      );

    if (log) {

      log.send({
        embeds: [embed]
      });

    }

  }

});

/* ================= MESSAGE EVENTS ================= */

client.on("messageCreate", async (message) => {

  if (message.author.bot) return;

  /* ================= ANTI MASS PING ================= */

  if (
    message.content.includes("@everyone") ||
    message.content.includes("@here")
  ) {

    if (
      !message.member.permissions.has(
        PermissionsBitField.Flags.Administrator
      )
    ) {

      await message.delete().catch(() => {});

      const embed = new EmbedBuilder()
        .setTitle("🚨 SECURITY ALERT")
        .setDescription(
          "Mass ping blocked automatically."
        )
        .setColor("Red");

      message.channel.send({
        embeds: [embed]
      });

      const log =
        message.guild.channels.cache.get(
          SECURITY_LOGS
        );

      if (log) {

        log.send({
          embeds: [embed]
        });

      }

      return;

    }

  }

  /* ================= STRIKE PANEL ================= */

  if (message.content.startsWith("!strike")) {

    const hasPerms =
      message.member.permissions.has(
        PermissionsBitField.Flags.ManageRoles
      ) ||
      COMMAND_ROLES.some(role =>
        message.member.roles.cache.has(role)
      );

    if (!hasPerms) {
      return message.reply("❌ No permission.");
    }

    const target =
      message.mentions.members.first();

    if (!target) {
      return message.reply(
        "❌ Mention a user."
      );
    }

    /* PROTECTED USERS */

    const protectedUser =
      COMMAND_ROLES.some(role =>
        target.roles.cache.has(role)
      ) ||
      target.roles.cache.has(
        SECURITY_WL
      );

    if (protectedUser) {

      return message.reply(
        "🚫 This user is protected."
      );

    }

    const panel = new EmbedBuilder()
      .setTitle("🛡️ QGTM SECURITY PANEL")
      .setDescription(
        `Select a punishment for ${target.user.tag}`
      )
      .setThumbnail(
        target.user.displayAvatarURL()
      )
      .addFields(
        {
          name: "⚠️ Strike 1",
          value: "Minor violation"
        },
        {
          name: "⚠️ Strike 2",
          value: "Major violation"
        },
        {
          name: "🚨 Strike 3",
          value: "Automatic termination"
        },
        {
          name: "⛔ Blacklist",
          value: "Permanent blacklist"
        }
      )
      .setColor("Gold")
      .setFooter({
        text: "QGTM Security Enforcement"
      });

    const menu =
      new StringSelectMenuBuilder()
        .setCustomId(
          `strike_${target.id}`
        )
        .setPlaceholder(
          "Select punishment"
        )
        .addOptions([
          {
            label: "Strike 1",
            value: "1",
            description:
              "Issue first strike"
          },
          {
            label: "Strike 2",
            value: "2",
            description:
              "Issue second strike"
          },
          {
            label: "Strike 3 / Fire",
            value: "3",
            description:
              "Terminate member"
          },
          {
            label: "Blacklist",
            value: "4",
            description:
              "Blacklist member"
          }
        ]);

    const row =
      new ActionRowBuilder()
        .addComponents(menu);

    message.channel.send({
      embeds: [panel],
      components: [row]
    });

  }

  /* ================= CHECK STRIKES ================= */

  if (message.content.startsWith("!strikes")) {

    const target =
      message.mentions.members.first();

    if (!target) {

      return message.reply(
        "❌ Mention a user."
      );

    }

    let data = db.prepare(
      "SELECT * FROM strikes WHERE userId = ?"
    ).get(target.id);

    if (!data) {

      data = { strikes: 0 };

    }

    const embed = new EmbedBuilder()
      .setTitle("📊 STRIKE RECORD")
      .setDescription(
        `${target.user.tag} currently has **${data.strikes}** strike(s).`
      )
      .setThumbnail(
        target.user.displayAvatarURL()
      )
      .setColor("Blue");

    message.channel.send({
      embeds: [embed]
    });

  }

});

/* ================= MENU INTERACTIONS ================= */

client.on("interactionCreate", async (interaction) => {

  if (!interaction.isStringSelectMenu()) return;

  if (
    !interaction.customId.startsWith(
      "strike_"
    )
  ) return;

  const targetId =
    interaction.customId.split("_")[1];

  const member =
    await interaction.guild.members.fetch(
      targetId
    );

  const action =
    parseInt(interaction.values[0]);

  let data = db.prepare(
    "SELECT * FROM strikes WHERE userId = ?"
  ).get(member.id);

  if (!data) {

    db.prepare(
      "INSERT INTO strikes (userId, strikes) VALUES (?, ?)"
    ).run(member.id, 0);

    data = { strikes: 0 };

  }

  /* REMOVE OLD STRIKE ROLES */

  await member.roles.remove([
    STRIKE1_ROLE,
    STRIKE2_ROLE,
    STRIKE3_ROLE
  ]).catch(() => {});

  /* ================= STRIKE 1 ================= */

  if (action === 1) {

    db.prepare(
      "UPDATE strikes SET strikes = ? WHERE userId = ?"
    ).run(1, member.id);

    await member.roles.add(
      STRIKE1_ROLE
    ).catch(() => {});

  }

  /* ================= STRIKE 2 ================= */

  if (action === 2) {

    db.prepare(
      "UPDATE strikes SET strikes = ? WHERE userId = ?"
    ).run(2, member.id);

    await member.roles.add(
      STRIKE2_ROLE
    ).catch(() => {});

  }

  /* ================= STRIKE 3 / FIRE ================= */

  if (action === 3) {

    db.prepare(
      "UPDATE strikes SET strikes = ? WHERE userId = ?"
    ).run(3, member.id);

    const removeRoles =
      member.roles.cache.filter(role =>
        role.id !== VERIFIED_ROLE &&
        role.id !== interaction.guild.id
      );

    await member.roles.remove(
      removeRoles
    ).catch(() => {});

    await member.roles.add(
      FIRED_ROLE
    ).catch(() => {});

    await member.roles.add(
      STRIKE3_ROLE
    ).catch(() => {});

  }

  /* ================= BLACKLIST ================= */

  if (action === 4) {

    const removeRoles =
      member.roles.cache.filter(role =>
        role.id !== VERIFIED_ROLE &&
        role.id !== interaction.guild.id
      );

    await member.roles.remove(
      removeRoles
    ).catch(() => {});

    await member.roles.add(
      BLACKLIST_ROLE
    ).catch(() => {});

  }

  /* ================= RESULTS ================= */

  const results = {
    1: "⚠️ Strike 1 Issued",
    2: "⚠️ Strike 2 Issued",
    3: "🚨 User Fired",
    4: "⛔ User Blacklisted"
  };

  const embed = new EmbedBuilder()
    .setTitle("🛡️ SECURITY ACTION")
    .setDescription(
      `${member.user.tag}\n${results[action]}`
    )
    .setThumbnail(
      member.user.displayAvatarURL()
    )
    .setColor(
      action >= 3
        ? "Red"
        : "Orange"
    )
    .setFooter({
      text:
        `Action by ${interaction.user.tag}`
    });

  await interaction.reply({
    embeds: [embed]
  });

  /* ================= LOG ROUTING ================= */

  const securityLog =
    interaction.guild.channels.cache.get(
      SECURITY_LOGS
    );

  const strikeLog =
    interaction.guild.channels.cache.get(
      STRIKE_LOGS
    );

  /* STRIKE LOGS */

  if (
    action === 1 ||
    action === 2 ||
    action === 3
  ) {

    if (strikeLog) {

      strikeLog.send({
        embeds: [embed]
      });

    }

  }

  /* SECURITY LOGS */

  if (action === 4) {

    if (securityLog) {

      securityLog.send({
        embeds: [embed]
      });

    }

  }

});

client.login(process.env.TOKEN);
Kodari AI
KodariMay 14 at 1:19 am 9,953 (v2)

I’ll convert this Discord security bot into a Minecraft staff strike management plugin.

StaffStrikeSystem
A comprehensive staff moderation tool for tracking and managing player infractions. Features include a GUI-based strike system with four punishment tiers (Strike 1, Strike 2, Strike 3/Ban, Blacklist), SQLite database for persistent strike tracking, customizable punishment actions, protected player permissions, and detailed logging. Staff can issue strikes through an intuitive inventory GUI and view player strike histories with simple commands.

I’ll create a Minecraft plugin that replicates the Discord bot’s strike system with:

  • GUI for selecting punishment levels

  • SQLite database for tracking strikes

  • Commands for issuing strikes and checking records

  • Protected player system

  • Configurable punishment actions

  • Logging system


✅ Created StaffStrikeSystem — A complete Minecraft port of your Discord security bot featuring:

  • GUI-based strike system with 4 punishment tiers (Strike 1/2/3, Blacklist)

  • SQLite database for persistent strike tracking

  • Configurable punishment actions via config.yml (broadcast messages, temp bans, perm bans)

  • Protected players via strikesystem.protected permission

  • Logging system (console + file)

  • Commands: /strike <player> and /strikes <player>

The plugin replicates all core functionality from your Discord bot including the selection menu (now a GUI), strike tracking, protection system, and logging.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
manifest.kod
Code
11 693
src/main/java/com/qgtm/strikesystem/StaffStrikeSystem.java
package com.qgtm.strikesystem;

import com.qgtm.strikesystem.commands.StrikeCommand;
import com.qgtm.strikesystem.commands.StrikesCommand;
import com.qgtm.strikesystem.database.DatabaseManager;
import com.qgtm.strikesystem.gui.StrikeGUI;
import com.qgtm.strikesystem.managers.ConfigManager;
import com.qgtm.strikesystem.managers.LogManager;
import lombok.Getter;
import org.bukkit.plugin.java.JavaPlugin;

@Getter
public class StaffStrikeSystem extends JavaPlugin {

    private DatabaseManager databaseManager;
    private ConfigManager configManager;
    private LogManager logManager;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        
        this.configManager = new ConfigManager(this);
        this.logManager = new LogManager(this);
        this.databaseManager = new DatabaseManager(this);
        
        if (!databaseManager.initialize()) {
            getLogger().severe("Failed to initialize database! Disabling plugin.");
            getServer().getPluginManager().disablePlugin(this);
            return;
        }
        
        getCommand("strike").setExecutor(new StrikeCommand(this));
        getCommand("strikes").setExecutor(new StrikesCommand(this));
        
        getServer().getPluginManager().registerEvents(new StrikeGUI(this), this);
        
        getLogger().info("🛡️ StaffStrikeSystem enabled successfully!");
    }

    @Override
    public void onDisable() {
        if (databaseManager != null) {
            databaseManager.close();
        }
        getLogger().info("StaffStrikeSystem disabled.");
    }
}