Spaces:
Runtime error
Runtime error
Update index.js
Browse files115 unmodified lines1161171181191201213 unmodified lines125126127128129130250 unmodified lines381382383384385386115 unmodified lines}});// --- 3. EVENT HANDLERS ---// Message Command Handler (Prefix Support)3 unmodified linesconst args = message.content.slice(PREFIX.length).trim().split(/ +/);const commandName = args.shift().toLowerCase();if (commandName === 'ping') {const msg = await message.reply('Pinging...');msg.edit(`Pong! Latency: ${msg.createdTimestamp - message.createdTimestamp}ms`);250 unmodified lines// Interaction Handlerclient.on('interactionCreate', async (interaction) => {if (interaction.isChatInputCommand()) {if (interaction.commandName === 'ping') {await interaction.reply(`Latency: ${client.ws.ping}ms`);}115 unmodified lines1161171181191201211221231241251261271281291301311321331341351361371381391401411423 unmodified lines146147148149150151152153154155156250 unmodified lines407408409410411412413414415115 unmodified lines}});async function logTransaction(client, commandName, user, guild, link) {try {const logChannelId = '1495044946107961364';const channel = await client.channels.fetch(logChannelId).catch(() => null);if (channel) {const embed = new EmbedBuilder().setTitle(`Command Executed: ${commandName}`).addFields({ name: 'User', value: `${user.tag} (${user.id})`, inline: true },{ name: 'Server', value: guild ? `${guild.name} (${guild.id})` : 'DM', inline: true },{ name: 'Link', value: link || 'N/A', inline: false }).setColor(0x5865F2).setTimestamp();await channel.send({ embeds: [embed] }).catch(() => {});}} catch (e) {console.error("Log Transaction Error:", e);}}// --- 3. EVENT HANDLERS ---// Message Command Handler (Prefix Support)3 unmodified linesconst args = message.content.slice(PREFIX.length).trim().split(/ +/);const commandName = args.shift().toLowerCase();const allCommands = [...commandsData.map(c => c.name), 'sync', 'sync_cmds', 'reboot', 'grantservers', 'servers', 'help'];if (allCommands.includes(commandName)) {logTransaction(client, commandName, message.author, message.guild, message.url);}if (commandName === 'ping') {const msg = await message.reply('Pinging...');msg.edit(`Pong! Latency: ${msg.createdTimestamp - message.createdTimestamp}ms`);250 unmodified lines// Interaction Handlerclient.on('interactionCreate', async (interaction) => {if (interaction.isChatInputCommand()) {const link = `https://discord.com/channels/${interaction.guildId || '@me'}/${interaction.channelId}`;logTransaction(client, interaction.commandName, interaction.user, interaction.guild, link);if (interaction.commandName === 'ping') {await interaction.reply(`Latency: ${client.ws.ping}ms`);}
index.js+29