Brozy123 commited on
Commit
99df2d4
·
verified ·
1 Parent(s): 0912fe9

Update index.js

Browse files
Files changed (1) hide show
  1. index.js +51 -2
index.js CHANGED
@@ -54,6 +54,7 @@ try {
54
  const { UI } = require('./NewBotStyle');
55
  const broadcastSystem = require('./broadcast_system');
56
  const grantSystem = require('./grant_system');
 
57
  console.log(`[SYSTEM] Starting FriendlyBot v4.0 (Watchdog Relaxed: ${new Date().toISOString()})`);
58
 
59
  process.on('unhandledRejection', (reason, promise) => {
@@ -700,6 +701,15 @@ client.on('messageCreate', async (message) => {
700
  else if (type === 'loss') record.losses++;
701
  else record.draws++;
702
 
 
 
 
 
 
 
 
 
 
703
  // Auto-increment matches for everyone on the lineup board
704
  const lineup = getGuildLineup(message.guildId);
705
  const playersOnBoard = new Set();
@@ -854,7 +864,7 @@ client.on('messageCreate', async (message) => {
854
  return;
855
  }
856
 
857
- if (commandName === 'grantservers' || commandName === 'revokeservers') {
858
  const targetUser = message.mentions.users.first();
859
  if (!targetUser) return message.reply("❌ Please mention the user! (e.g. `!grantservers @User`) ");
860
 
@@ -868,9 +878,48 @@ client.on('messageCreate', async (message) => {
868
  return;
869
  }
870
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
871
 
872
 
873
- if (commandName === 'servers') {
874
  const app = await client.application.fetch();
875
  const ownerId = app.owner?.ownerId || app.owner?.id;
876
 
 
54
  const { UI } = require('./NewBotStyle');
55
  const broadcastSystem = require('./broadcast_system');
56
  const grantSystem = require('./grant_system');
57
+ const premiumStore = require('./premiumStore');
58
  console.log(`[SYSTEM] Starting FriendlyBot v4.0 (Watchdog Relaxed: ${new Date().toISOString()})`);
59
 
60
  process.on('unhandledRejection', (reason, promise) => {
 
701
  else if (type === 'loss') record.losses++;
702
  else record.draws++;
703
 
704
+ // Auto-grant Premium to the person who recorded the win
705
+ if (type === 'win') {
706
+ const winnerId = message.author.id;
707
+ if (!premiumStore.isPremium(winnerId)) {
708
+ premiumStore.grantUser(winnerId, "league_win", null);
709
+ await message.channel.send(`🏆 **${message.author.tag}** earned **Premium** for winning this league match! ⭐`);
710
+ }
711
+ }
712
+
713
  // Auto-increment matches for everyone on the lineup board
714
  const lineup = getGuildLineup(message.guildId);
715
  const playersOnBoard = new Set();
 
864
  return;
865
  }
866
 
867
+ if (commandName === 'grantservers' || commandName === 'revokeservers') {
868
  const targetUser = message.mentions.users.first();
869
  if (!targetUser) return message.reply("❌ Please mention the user! (e.g. `!grantservers @User`) ");
870
 
 
878
  return;
879
  }
880
 
881
+ // --- PREMIUM COMMANDS (Owner Only) ---
882
+ if (commandName === 'givepremium' || commandName === 'removepremium') {
883
+ const app = await client.application.fetch();
884
+ const ownerId = app.owner?.ownerId || app.owner?.id;
885
+ if (message.author.id !== ownerId) return message.reply("❌ Only the bot owner can manage premium.");
886
+
887
+ const targetUser = message.mentions.users.first();
888
+ if (!targetUser) return message.reply("❌ Please mention a user! e.g. `!givepremium @User`");
889
+
890
+ if (commandName === 'givepremium') {
891
+ premiumStore.grantUser(targetUser.id, "manual", null);
892
+ await message.reply(`✅ **${targetUser.tag}** now has Premium access (lifetime).`);
893
+ } else {
894
+ premiumStore.revokeUser(targetUser.id);
895
+ await message.reply(`✅ Revoked Premium from **${targetUser.tag}**.`);
896
+ }
897
+ return;
898
+ }
899
+
900
+ // --- PREMIUM INFO ---
901
+ if (commandName === 'premium') {
902
+ const user = message.author;
903
+ const status = premiumStore.isPremium(user.id);
904
+ const embed = new EmbedBuilder()
905
+ .setTitle("⭐ FriendlyBot Premium")
906
+ .setDescription(status
907
+ ? "You have **Premium** access! Here's what's included:\n\n"
908
+ : "You **do not** have Premium.\n\nWin a league match to earn it, or the bot owner can grant it.\n\nUnlocks:\n\n")
909
+ .addFields(
910
+ { name: "📊 Advanced Stats & Analytics", value: "Track goals, assists, clean sheets, and weekly leaderboards.", inline: false },
911
+ { name: "📅 Match Scheduling & Reminders", value: "Auto-post scheduled matches with DM reminders 60 minutes before kickoff.", inline: false },
912
+ { name: "🎴 Player Profile Cards", value: "Advanced `/profileimage` with extra stats and custom backgrounds.", inline: false },
913
+ { name: "🔧 Custom Command Aliases", value: "Rename bot commands to fit your server (e.g. `!ff` for `!friendly`).", inline: false }
914
+ )
915
+ .setColor(0xFFD700)
916
+ .setFooter({ text: "FriendlyBot Premium" });
917
+ await message.channel.send({ embeds: [embed] });
918
+ return;
919
+ }
920
 
921
 
922
+ if (commandName === 'servers') {
923
  const app = await client.application.fetch();
924
  const ownerId = app.owner?.ownerId || app.owner?.id;
925