Re-loader By R-1n Password <Bonus Inside>

function registerFail(ip) const entry = attemptCounter.get(ip); entry.count++;

// 1️⃣ Owner check (optional) if (interaction.user.id !== OWNER_ID) return interaction.reply( content: '❌ You are not allowed to use this command.', ephemeral: true );

client.once('ready', () => console.log(`🤖 Logged in as $client.user.tag`)); re-loader by r-1n password

// Optional: double‑confirm await modal.reply( content: '⚠️ Are you sure? React with ✅ within 10 s to proceed.', fetchReply: true ) .then(async msg => await msg.react('✅'); const filter = (reaction, user) => reaction.emoji.name === '✅' && user.id === modal.user.id; const collected = await msg.awaitReactions( filter, max: 1, time: 10_000, errors: ['time'] ) .catch(() => null);

if (!collected) await msg.edit('⏹️ Reload aborted (no confirmation).'); return; function registerFail(ip) const entry = attemptCounter

<button id="reloadBtn">🔁 Reload (protected)</button> <div id="log"></div>

// ----- Reload action ------------------------------------------------------ async function performReload() // Example: clear in‑memory cache, re‑init DB pool, or restart a child process. console.log('🔁 Reload triggered at', new Date().toISOString()); // Insert your real reload logic here. client

client.login(process.env.BOT_TOKEN);

const client = new Client( intents: [GatewayIntentBits.Guilds] ); const RELOADER_PASSWORD = process.env.RELOADER_PWD || 'r-1n'; const OWNER_ID = process.env.OWNER_ID; // Discord user ID of the admin

// ----- CONFIG ----------------------------------------------------------- const RELOADER_PASSWORD = process.env.RELOADER_PASSWORD || 'r-1n'; const MAX_ATTEMPTS = 5; let attemptCounter = new Map(); // ip => count, resetTimeout

curl -X POST http://localhost:3000/admin/reload \ -H "X-ReLoader-Pwd: r-1n" You can replace the static password with an OTP generator (e.g., speakeasy TOTP) for stronger security. Perfect for a “re‑loader” that only the bot owner (or a privileged role) can fire. // bot.js --------------------------------------------------------------- const Client, GatewayIntentBits, PermissionsBitField = require('discord.js'); require('dotenv').config(); // .env contains BOT_TOKEN and RELOADER_PWD

Vous êtes hors-ligne
Connexion rétablie...