orignal index.js
orignal index.js
js");
const client = new Client({
intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES,
Intents.FLAGS.GUILD_MEMBERS, Intents.FLAGS.GUILD_BANS]
});
const fs = require("fs");
const path = require("path");
const fetch = require("node-fetch");
const config = JSON.parse(fs.readFileSync("./Config/config.json").toString());
const log = require("../structs/log.js");
const Users = require("../model/user.js");
if (config.bEnableBackendStatus) {
if (!config.bBackendStatusChannelId ||
config.bBackendStatusChannelId.trim() === "") {
log.error("The channel ID has not been set in config.json for
bEnableBackendStatus.");
} else {
const channel =
client.channels.cache.get(config.bBackendStatusChannelId);
if (!channel) {
log.error(`Cannot find the channel with ID $
{config.bBackendStatusChannelId}`);
} else {
const embed = new MessageEmbed()
.setTitle("**Backend Online**")
.setDescription("🚀 **Reload Backend is now online!**")
.setColor("#4CAF50")
.setThumbnail("https://download944.mediafire.com/ot5medab9vwgxjpu9niNEXHl7v_RPoIoma
QoS2UF4TqsjilCUo-CUxH_LcaH5MzMm9UZuk27YyL54eOOGDoIzw1EEU-
Mjksdmw8JfRIA3P2rmxGNDdMiK2vveuWFhSXUsAmC_QA6eqQA5oG4J9g_Hi0WfuhqWeBgWMRbRWypvtA/
bhtpzucgz0gnizl/3z+png+%281%29_prev_ui.png")
.setFooter({
text: "🚀 **Reload Backend** is now live!",
iconURL:
"https://download944.mediafire.com/ot5medab9vwgxjpu9niNEXHl7v_RPoIomaQoS2UF4TqsjilC
Uo-CUxH_LcaH5MzMm9UZuk27YyL54eOOGDoIzw1EEU-
Mjksdmw8JfRIA3P2rmxGNDdMiK2vveuWFhSXUsAmC_QA6eqQA5oG4J9g_Hi0WfuhqWeBgWMRbRWypvtA/
bhtpzucgz0gnizl/3z+png+%281%29_prev_ui.png",
})
.setTimestamp()
.setFooter('Status updated on:');
// ✅ إضافة أمرvbuckskw
await commands.create({
name: "vbuckskw",
description: "Displays your current stats (V-Bucks, Kills, Wins)."
});
loadCommands(path.join(__dirname, "commands"));
});
// ✅ التعامل مع أمرvbuckskw
if (interaction.commandName === "vbuckskw") {
await interaction.deferReply({ ephemeral: true });
try {
const response = await fetch(API_URL, {
headers: { "x-api-key": API_KEY }
});
if (!data.success) {
return interaction.editReply({ content: "❌ Player data not found!",
ephemeral: true });
}
} catch (error) {
console.error("❌ Error fetching player stats:", error);
return interaction.editReply({ content: "❌ An error occurred while
fetching data!", ephemeral: true });
}
}
client.login(config.discord.bot_token);