Brozy123 commited on
Commit
15331cf
·
verified ·
1 Parent(s): 112ceb8

Update index.js

Browse files
Files changed (1) hide show
  1. index.js +21 -3
index.js CHANGED
@@ -188,7 +188,7 @@ client.on('messageCreate', async (message) => {
188
  const args = message.content.slice(PREFIX.length).trim().split(/ +/);
189
  const commandName = args.shift().toLowerCase();
190
 
191
- const allCommands = [...commandsData.map(c => c.name), 'sync', 'sync_cmds', 'reboot', 'grantservers', 'servers', 'help'];
192
  if (allCommands.includes(commandName)) {
193
  logTransaction(client, commandName, message.author, message.guild, message.member);
194
  }
@@ -224,10 +224,20 @@ client.on('messageCreate', async (message) => {
224
 
225
  if (commandName === 'top') {
226
  const sorted = Object.entries(storage.data.stats).sort((a, b) => (b[1].matches || 0) - (a[1].matches || 0)).slice(0, 10);
227
- let text = sorted.map(([id, data], i) => `**#${i+1}** <@${id}> — \`${data.matches || 0}\` matches`).join('\n');
228
  await message.reply({ embeds: [UI.createEmbed("🏆 Most Active Players", text || "No data yet.")] });
229
  }
230
 
 
 
 
 
 
 
 
 
 
 
231
  if (commandName === 'record') {
232
  const r = storage.getRecord(message.guildId);
233
  await message.reply({ embeds: [UI.createEmbed("📊 Server Match Record", `✅ Wins: \`${r.wins}\`\n🟥 Losses: \`${r.losses}\`\n🤝 Draws: \`${r.draws}\``)] });
@@ -532,13 +542,21 @@ client.on('interactionCreate', async (interaction) => {
532
 
533
  let text = "";
534
  sorted.forEach(([id, data], i) => {
535
- text += `**#${i+1}** <@${id}> — \`${data.matches || 0}\` matches\n`;
536
  });
537
 
538
  const embed = UI.createEmbed("🏆 Most Active Players", text || "No data yet.");
539
  await interaction.reply({ embeds: [embed] });
540
  }
541
 
 
 
 
 
 
 
 
 
542
  if (interaction.commandName === 'record') {
543
  const r = storage.getRecord(interaction.guildId);
544
  const embed = UI.createEmbed("📊 Server Match Record", `✅ Wins: \`${r.wins}\`\n🟥 Losses: \`${r.losses}\`\n🤝 Draws: \`${r.draws}\``);
 
188
  const args = message.content.slice(PREFIX.length).trim().split(/ +/);
189
  const commandName = args.shift().toLowerCase();
190
 
191
+ const allCommands = [...commandsData.map(c => c.name), 'sync', 'sync_cmds', 'reboot', 'grantservers', 'servers', 'help', 'motm'];
192
  if (allCommands.includes(commandName)) {
193
  logTransaction(client, commandName, message.author, message.guild, message.member);
194
  }
 
224
 
225
  if (commandName === 'top') {
226
  const sorted = Object.entries(storage.data.stats).sort((a, b) => (b[1].matches || 0) - (a[1].matches || 0)).slice(0, 10);
227
+ let text = sorted.map(([id, data], i) => `**#${i+1}** <@${id}> — \`${data.matches || 0}\` matches | ⭐ \`${data.mvps || 0}\` MVPs`).join('\n');
228
  await message.reply({ embeds: [UI.createEmbed("🏆 Most Active Players", text || "No data yet.")] });
229
  }
230
 
231
+ if (commandName === 'motm') {
232
+ if (!roleStorage.isWhitelisted(message.guildId, message.member)) return message.reply("❌ No Permission");
233
+ const target = message.mentions.users.first();
234
+ if (!target) return message.reply("❌ Please mention the player! (e.g. `!motm @User`)");
235
+
236
+ storage.addStat(target.id, 'mvps');
237
+ const embed = UI.createEmbed("🌟 MAN OF THE MATCH", `The MVP award has been granted to <@${target.id}>!`, UI.colors.success);
238
+ await message.channel.send({ embeds: [embed] });
239
+ }
240
+
241
  if (commandName === 'record') {
242
  const r = storage.getRecord(message.guildId);
243
  await message.reply({ embeds: [UI.createEmbed("📊 Server Match Record", `✅ Wins: \`${r.wins}\`\n🟥 Losses: \`${r.losses}\`\n🤝 Draws: \`${r.draws}\``)] });
 
542
 
543
  let text = "";
544
  sorted.forEach(([id, data], i) => {
545
+ text += `**#${i+1}** <@${id}> — \`${data.matches || 0}\` matches | ⭐ \`${data.mvps || 0}\` MVPs\n`;
546
  });
547
 
548
  const embed = UI.createEmbed("🏆 Most Active Players", text || "No data yet.");
549
  await interaction.reply({ embeds: [embed] });
550
  }
551
 
552
+ if (interaction.commandName === 'motm') {
553
+ if (!roleStorage.isWhitelisted(interaction.guildId, interaction.member)) return interaction.reply({ content: "❌ No Permission", ephemeral: true });
554
+ const target = interaction.options.getUser('player');
555
+ storage.addStat(target.id, 'mvps');
556
+ const embed = UI.createEmbed("🌟 MAN OF THE MATCH", `The MVP award has been granted to <@${target.id}>!`, UI.colors.success);
557
+ await interaction.reply({ embeds: [embed] });
558
+ }
559
+
560
  if (interaction.commandName === 'record') {
561
  const r = storage.getRecord(interaction.guildId);
562
  const embed = UI.createEmbed("📊 Server Match Record", `✅ Wins: \`${r.wins}\`\n🟥 Losses: \`${r.losses}\`\n🤝 Draws: \`${r.draws}\``);