Spaces:
Runtime error
Runtime error
Update index.js
Browse files
index.js
CHANGED
|
@@ -142,9 +142,12 @@ const commandsData = [
|
|
| 142 |
{ name: 'time', type: 3, description: 'Time (e.g. 5pm)', required: false }
|
| 143 |
]
|
| 144 |
},
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
|
|
|
|
|
|
|
|
|
| 148 |
{ name: 'clear', description: 'Clear messages', options: [{ name: 'amount', type: 4, description: 'Number of messages', required: true }] },
|
| 149 |
{ name: 'lock', description: 'Lock the current channel' },
|
| 150 |
{ name: 'unlock', description: 'Unlock the current channel' },
|
|
@@ -1487,48 +1490,94 @@ client.on('interactionCreate', async (interaction) => {
|
|
| 1487 |
await safeReply(interaction, { content: `🟢 **Online**\nWhitelist: ${rInfo}` });
|
| 1488 |
}
|
| 1489 |
|
| 1490 |
-
|
| 1491 |
-
|
| 1492 |
-
|
| 1493 |
-
|
| 1494 |
-
|
| 1495 |
-
|
| 1496 |
-
|
| 1497 |
-
|
| 1498 |
-
|
| 1499 |
-
|
| 1500 |
-
|
| 1501 |
-
|
| 1502 |
-
|
| 1503 |
-
|
| 1504 |
-
|
| 1505 |
-
|
| 1506 |
-
|
| 1507 |
-
|
| 1508 |
-
|
| 1509 |
-
|
| 1510 |
-
|
| 1511 |
-
|
| 1512 |
-
|
| 1513 |
-
|
| 1514 |
-
|
| 1515 |
-
|
| 1516 |
-
|
| 1517 |
-
|
| 1518 |
-
|
| 1519 |
-
|
| 1520 |
-
|
| 1521 |
-
|
| 1522 |
-
|
| 1523 |
-
|
| 1524 |
-
|
| 1525 |
-
|
| 1526 |
-
|
| 1527 |
-
|
| 1528 |
-
|
| 1529 |
-
|
| 1530 |
-
|
| 1531 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1532 |
|
| 1533 |
if (interaction.commandName === 'clear') {
|
| 1534 |
if (!roleStorage.isWhitelisted(interaction.guildId, interaction.member)) return safeReply(interaction, { content: "❌ No Permission", flags: [MessageFlags.Ephemeral] });
|
|
|
|
| 142 |
{ name: 'time', type: 3, description: 'Time (e.g. 5pm)', required: false }
|
| 143 |
]
|
| 144 |
},
|
| 145 |
+
{ name: 'lineup', description: 'Show current lineup board', options: [
|
| 146 |
+
{ name: 'mention', type: 3, description: 'Mention type (everyone or here)', required: false }
|
| 147 |
+
] },
|
| 148 |
+
{ name: 'scrimlineup', description: 'Show scrimmage lineup board (two teams facing each other)', options: [
|
| 149 |
+
{ name: 'mention', type: 3, description: 'Mention type (everyone or here)', required: false }
|
| 150 |
+
] },
|
| 151 |
{ name: 'clear', description: 'Clear messages', options: [{ name: 'amount', type: 4, description: 'Number of messages', required: true }] },
|
| 152 |
{ name: 'lock', description: 'Lock the current channel' },
|
| 153 |
{ name: 'unlock', description: 'Unlock the current channel' },
|
|
|
|
| 1490 |
await safeReply(interaction, { content: `🟢 **Online**\nWhitelist: ${rInfo}` });
|
| 1491 |
}
|
| 1492 |
|
| 1493 |
+
if (interaction.commandName === 'lineup') {
|
| 1494 |
+
console.log(`[DEBUG] LINEUP-INTERACT: guild=${interaction.guildId} user=${interaction.user?.id} ` +
|
| 1495 |
+
`args=${JSON.stringify(interaction.options?.getString?.('mention'))}`);
|
| 1496 |
+
if (!roleStorage.isWhitelisted(interaction.guildId, interaction.member)) return sendNoPermission(interaction);
|
| 1497 |
+
|
| 1498 |
+
const mention = interaction.options.getString('mention') || 'everyone';
|
| 1499 |
+
const pingType = mention.toLowerCase() === 'here' ? 'here' : 'everyone';
|
| 1500 |
+
guildPingType.set(interaction.guildId, pingType);
|
| 1501 |
+
|
| 1502 |
+
lineupOwners.set(interaction.guildId, interaction.user.id);
|
| 1503 |
+
saveLineup();
|
| 1504 |
+
const row1 = new ActionRowBuilder().addComponents(
|
| 1505 |
+
new StringSelectMenuBuilder()
|
| 1506 |
+
.setCustomId('formation_select_initial_7v7')
|
| 1507 |
+
.setPlaceholder('⚽ Select 7v7 Formation...')
|
| 1508 |
+
.addOptions(Object.keys(FORMATIONS).filter(k => FORMATIONS[k].length === 7).slice(0, 25).map(k => ({ label: `${k} (7v7)`, value: k })))
|
| 1509 |
+
);
|
| 1510 |
+
const row2 = new ActionRowBuilder().addComponents(
|
| 1511 |
+
new StringSelectMenuBuilder()
|
| 1512 |
+
.setCustomId('formation_select_initial_11v11')
|
| 1513 |
+
.setPlaceholder('🏆 Select 11v11 Formation...')
|
| 1514 |
+
.addOptions(Object.keys(FORMATIONS).filter(k => FORMATIONS[k].length === 11).slice(0, 25).map(k => ({ label: k, value: k })))
|
| 1515 |
+
);
|
| 1516 |
+
const row3 = new ActionRowBuilder().addComponents(
|
| 1517 |
+
new StringSelectMenuBuilder()
|
| 1518 |
+
.setCustomId('formation_select_initial_other')
|
| 1519 |
+
.setPlaceholder('🎮 Select Other Sizes (6v6, 8v8, 9v9, 10v10)...')
|
| 1520 |
+
.addOptions(Object.keys(FORMATIONS).filter(k => FORMATIONS[k].length !== 7 && FORMATIONS[k].length !== 11).slice(0, 25).map(k => ({ label: k, value: k })))
|
| 1521 |
+
);
|
| 1522 |
+
const row4 = new ActionRowBuilder().addComponents(
|
| 1523 |
+
new ButtonBuilder()
|
| 1524 |
+
.setCustomId('open_custom_lineup_modal')
|
| 1525 |
+
.setLabel('Custom Positions / Numbers')
|
| 1526 |
+
.setStyle(ButtonStyle.Primary)
|
| 1527 |
+
.setEmoji("🛠️")
|
| 1528 |
+
);
|
| 1529 |
+
const embed = UI.createEmbed("📋 Initialize Lineup", "Select a formation from the dropdowns below, or create your own custom layout.", UI.colors.primary);
|
| 1530 |
+
const pingMention = pingType === 'here' ? '@here' : '@everyone';
|
| 1531 |
+
const mentionParse = ['everyone'];
|
| 1532 |
+
await safeReply(interaction, { content: `${pingMention}\n**Lineup Session Active!**`, embeds: [embed], components: [row1, row2, row3, row4], allowedMentions: { parse: mentionParse } });
|
| 1533 |
+
}
|
| 1534 |
+
|
| 1535 |
+
if (interaction.commandName === 'scrimlineup') {
|
| 1536 |
+
console.log(`[DEBUG] SCRIMLINEUP-INTERACT: guild=${interaction.guildId} user=${interaction.user?.id} ` +
|
| 1537 |
+
`args=${JSON.stringify(interaction.options?.getString?.('mention'))}`);
|
| 1538 |
+
if (!roleStorage.isWhitelisted(interaction.guildId, interaction.member)) return sendNoPermission(interaction);
|
| 1539 |
+
|
| 1540 |
+
const mention = interaction.options.getString('mention') || 'everyone';
|
| 1541 |
+
const pingType = mention.toLowerCase() === 'here' ? 'here' : 'everyone';
|
| 1542 |
+
guildPingType.set(interaction.guildId, pingType);
|
| 1543 |
+
|
| 1544 |
+
lineupOwners.set(interaction.guildId, interaction.user.id);
|
| 1545 |
+
saveLineup();
|
| 1546 |
+
|
| 1547 |
+
const lineup = getGuildLineup(interaction.guildId);
|
| 1548 |
+
lineup.clear();
|
| 1549 |
+
saveLineup();
|
| 1550 |
+
|
| 1551 |
+
const row1 = new ActionRowBuilder().addComponents(
|
| 1552 |
+
new StringSelectMenuBuilder()
|
| 1553 |
+
.setCustomId('formation_select_initial_7v7')
|
| 1554 |
+
.setPlaceholder('⚽ Select 7v7 Formation...')
|
| 1555 |
+
.addOptions(Object.keys(FORMATIONS).filter(k => FORMATIONS[k].length === 7).slice(0, 25).map(k => ({ label: `${k} (7v7)`, value: k })))
|
| 1556 |
+
);
|
| 1557 |
+
const row2 = new ActionRowBuilder().addComponents(
|
| 1558 |
+
new StringSelectMenuBuilder()
|
| 1559 |
+
.setCustomId('formation_select_initial_11v11')
|
| 1560 |
+
.setPlaceholder('🏆 Select 11v11 Formation...')
|
| 1561 |
+
.addOptions(Object.keys(FORMATIONS).filter(k => FORMATIONS[k].length === 11).slice(0, 25).map(k => ({ label: k, value: k })))
|
| 1562 |
+
);
|
| 1563 |
+
const row3 = new ActionRowBuilder().addComponents(
|
| 1564 |
+
new StringSelectMenuBuilder()
|
| 1565 |
+
.setCustomId('formation_select_initial_other')
|
| 1566 |
+
.setPlaceholder('🎮 Select Other Sizes (6v6, 8v8, 9v9, 10v10)...')
|
| 1567 |
+
.addOptions(Object.keys(FORMATIONS).filter(k => FORMATIONS[k].length !== 7 && FORMATIONS[k].length !== 11).slice(0, 25).map(k => ({ label: k, value: k })))
|
| 1568 |
+
);
|
| 1569 |
+
const row4 = new ActionRowBuilder().addComponents(
|
| 1570 |
+
new ButtonBuilder()
|
| 1571 |
+
.setCustomId('open_custom_lineup_modal')
|
| 1572 |
+
.setLabel('Custom Positions / Numbers')
|
| 1573 |
+
.setStyle(ButtonStyle.Primary)
|
| 1574 |
+
.setEmoji("🛠️")
|
| 1575 |
+
);
|
| 1576 |
+
const embed = UI.createEmbed("📋 Initialize Scrimmage Lineup", "Select a formation from the dropdowns below to start! Two teams will face each other.", UI.colors.primary);
|
| 1577 |
+
const pingMention = pingType === 'here' ? '@here' : '@everyone';
|
| 1578 |
+
const mentionParse = ['everyone'];
|
| 1579 |
+
await safeReply(interaction, { content: `${pingMention}\n**🔥 SCRIMMAGE LINEUP SESSION ACTIVE!**\n*Two teams facing each other!*`, embeds: [embed], components: [row1, row2, row3, row4], allowedMentions: { parse: mentionParse } });
|
| 1580 |
+
}
|
| 1581 |
|
| 1582 |
if (interaction.commandName === 'clear') {
|
| 1583 |
if (!roleStorage.isWhitelisted(interaction.guildId, interaction.member)) return safeReply(interaction, { content: "❌ No Permission", flags: [MessageFlags.Ephemeral] });
|