Spaces:
Running
Running
Update index.js
Browse files
index.js
CHANGED
|
@@ -34,7 +34,7 @@ console.log(">>> [BOOT] Loading Web Server module...");
|
|
| 34 |
const server = require('./server');
|
| 35 |
console.log(">>> [BOOT] Web Server module loaded.");
|
| 36 |
|
| 37 |
-
const { guildLineups, guildSelectedFormation, lineupOwners, activeLineupMessages, managerBoards, guildCustomFormations, guildCustomFormationNames, guildPingType, guildFriendlyPingType, save: saveLineup } = require('./lineup_persistence');
|
| 38 |
const guildActiveCategory = new Map(); // Stores the currently selected category in the UI for each guild
|
| 39 |
|
| 40 |
try {
|
|
@@ -514,31 +514,32 @@ client.on('messageCreate', async (message) => {
|
|
| 514 |
return;
|
| 515 |
}
|
| 516 |
|
| 517 |
-
|
| 518 |
-
|
| 519 |
|
| 520 |
-
|
| 521 |
-
|
| 522 |
-
|
| 523 |
|
| 524 |
-
|
| 525 |
-
|
|
|
|
| 526 |
|
| 527 |
-
|
| 528 |
-
|
| 529 |
-
|
| 530 |
-
|
| 531 |
|
| 532 |
-
|
| 533 |
-
console.log(`[DEBUG] LINEUP-MSG: guild=${message.guildId} pingType=${pingType} owner=${message.author?.id || 'unknown'}`);
|
| 534 |
const view = createLineupView(message.guildId);
|
| 535 |
const msg = await message.channel.send(view);
|
| 536 |
activeLineupMessages.set(message.guildId, { channelId: message.channelId, messageId: msg.id });
|
| 537 |
addToCleanupQueue(message.guildId, message.channelId, msg.id, 'lineup');
|
| 538 |
return;
|
| 539 |
-
|
| 540 |
|
| 541 |
-
|
| 542 |
if (!roleStorage.isWhitelisted(message.guildId, message.member)) return sendNoPermission(message);
|
| 543 |
|
| 544 |
const mentionArg = args[0] ? args[0].toLowerCase().replace('@', '') : null;
|
|
@@ -546,6 +547,7 @@ console.log(`[DEBUG] LINEUP-MSG: guild=${message.guildId} pingType=${pingType} o
|
|
| 546 |
guildPingType.set(message.guildId, pingType);
|
| 547 |
|
| 548 |
lineupOwners.set(message.guildId, message.author.id);
|
|
|
|
| 549 |
saveLineup();
|
| 550 |
|
| 551 |
const lineup = getGuildLineup(message.guildId);
|
|
@@ -558,7 +560,7 @@ console.log(`[DEBUG] LINEUP-MSG: guild=${message.guildId} pingType=${pingType} o
|
|
| 558 |
activeLineupMessages.set(message.guildId, { channelId: message.channelId, messageId: msg.id });
|
| 559 |
addToCleanupQueue(message.guildId, message.channelId, msg.id, 'lineup');
|
| 560 |
return;
|
| 561 |
-
|
| 562 |
|
| 563 |
if (commandName === 'top') {
|
| 564 |
const sorted = Object.entries(storage.data.stats).sort((a, b) => (b[1].matches || 0) - (a[1].matches || 0)).slice(0, 10);
|
|
@@ -846,16 +848,17 @@ console.log(`[DEBUG] LINEUP-MSG: guild=${message.guildId} pingType=${pingType} o
|
|
| 846 |
await message.reply(`✅ Swapped <@${p1.id}> with <@${p2.id}>!`);
|
| 847 |
|
| 848 |
// Update the board
|
| 849 |
-
|
| 850 |
-
|
| 851 |
-
|
| 852 |
-
|
| 853 |
-
|
| 854 |
-
|
| 855 |
-
|
| 856 |
-
|
| 857 |
-
|
| 858 |
-
|
|
|
|
| 859 |
|
| 860 |
if (commandName === 'sync' || commandName === 'sync_cmds') {
|
| 861 |
if (!message.member.permissions.has('Administrator')) return;
|
|
@@ -1501,6 +1504,7 @@ if (interaction.commandName === 'lineup') {
|
|
| 1501 |
guildPingType.set(interaction.guildId, pingType);
|
| 1502 |
|
| 1503 |
lineupOwners.set(interaction.guildId, interaction.user.id);
|
|
|
|
| 1504 |
saveLineup();
|
| 1505 |
const row1 = new ActionRowBuilder().addComponents(
|
| 1506 |
new StringSelectMenuBuilder()
|
|
@@ -1543,6 +1547,7 @@ if (interaction.commandName === 'lineup') {
|
|
| 1543 |
guildPingType.set(interaction.guildId, pingType);
|
| 1544 |
|
| 1545 |
lineupOwners.set(interaction.guildId, interaction.user.id);
|
|
|
|
| 1546 |
saveLineup();
|
| 1547 |
|
| 1548 |
const lineup = getGuildLineup(interaction.guildId);
|
|
@@ -1628,16 +1633,17 @@ if (interaction.commandName === 'lineup') {
|
|
| 1628 |
|
| 1629 |
await safeReply(interaction, { content: `✅ Swapped <@${p1.id}> with <@${p2.id}>!`, flags: [MessageFlags.Ephemeral] });
|
| 1630 |
|
| 1631 |
-
|
| 1632 |
-
|
| 1633 |
-
|
| 1634 |
-
|
| 1635 |
-
|
| 1636 |
-
|
| 1637 |
-
|
| 1638 |
-
|
| 1639 |
-
|
| 1640 |
-
|
|
|
|
| 1641 |
|
| 1642 |
if (interaction.commandName === 'sendlink') {
|
| 1643 |
if (!roleStorage.isWhitelisted(interaction.guildId, interaction.member)) return safeReply(interaction, { content: "❌ No Permission", flags: [MessageFlags.Ephemeral] });
|
|
@@ -1892,14 +1898,15 @@ if (interaction.commandName === 'lineup') {
|
|
| 1892 |
const tempKey = `custom_${guildId}`;
|
| 1893 |
guildSelectedFormation.set(guildId, tempKey);
|
| 1894 |
|
| 1895 |
-
|
| 1896 |
-
|
| 1897 |
-
|
| 1898 |
-
|
| 1899 |
|
| 1900 |
-
|
|
|
|
| 1901 |
|
| 1902 |
-
|
| 1903 |
if (interaction.message) {
|
| 1904 |
await interaction.update(view);
|
| 1905 |
activeLineupMessages.set(guildId, { channelId: interaction.channelId, messageId: interaction.message.id });
|
|
@@ -1926,31 +1933,33 @@ if (interaction.commandName === 'lineup') {
|
|
| 1926 |
}
|
| 1927 |
}
|
| 1928 |
|
| 1929 |
-
|
| 1930 |
-
|
| 1931 |
|
| 1932 |
-
|
| 1933 |
-
|
| 1934 |
-
|
| 1935 |
-
|
| 1936 |
|
| 1937 |
-
|
| 1938 |
-
|
| 1939 |
-
|
| 1940 |
-
|
| 1941 |
-
// Clear current lineup as formation changed
|
| 1942 |
-
const map = new Map();
|
| 1943 |
-
guildLineups.set(guildId, map);
|
| 1944 |
-
saveLineup();
|
| 1945 |
|
| 1946 |
-
|
| 1947 |
-
|
|
|
|
|
|
|
| 1948 |
|
| 1949 |
-
|
| 1950 |
-
|
| 1951 |
-
|
| 1952 |
-
|
| 1953 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1954 |
|
| 1955 |
if (interaction.isStringSelectMenu() && interaction.customId === 'formation_category_select') {
|
| 1956 |
if (!roleStorage.isWhitelisted(interaction.guildId, interaction.member)) return sendNoPermission(interaction);
|
|
@@ -2000,32 +2009,34 @@ if (interaction.commandName === 'lineup') {
|
|
| 2000 |
guildLineups.set(guildId, map);
|
| 2001 |
saveLineup();
|
| 2002 |
|
| 2003 |
-
|
| 2004 |
-
|
| 2005 |
-
try {
|
| 2006 |
-
const channel = interaction.channel;
|
| 2007 |
-
const publicMsg = await channel.messages.fetch(publicMessageId);
|
| 2008 |
-
await publicMsg.edit(createLineupView(guildId));
|
| 2009 |
-
} catch (e) {
|
| 2010 |
-
console.error("[!] Failed to update public board from ephemeral menu:", e.message);
|
| 2011 |
-
}
|
| 2012 |
-
return;
|
| 2013 |
-
}
|
| 2014 |
|
| 2015 |
-
|
| 2016 |
-
|
| 2017 |
-
|
| 2018 |
-
|
| 2019 |
-
|
| 2020 |
-
|
| 2021 |
-
|
| 2022 |
-
|
| 2023 |
-
|
| 2024 |
-
|
| 2025 |
-
|
| 2026 |
-
|
| 2027 |
-
|
| 2028 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2029 |
|
| 2030 |
if (interaction.isStringSelectMenu() && interaction.customId.startsWith('formation_select_')) {
|
| 2031 |
if (interaction.customId.includes('_initial_') || interaction.customId.includes('_active')) return;
|
|
@@ -2036,16 +2047,17 @@ if (interaction.commandName === 'lineup') {
|
|
| 2036 |
return interaction.reply({ content: `❌ Only <@${ownerId}> can change the formation!`, ephemeral: true });
|
| 2037 |
}
|
| 2038 |
|
| 2039 |
-
|
| 2040 |
-
|
| 2041 |
-
|
| 2042 |
-
|
| 2043 |
-
|
| 2044 |
-
|
| 2045 |
-
|
| 2046 |
-
|
|
|
|
| 2047 |
|
| 2048 |
-
|
| 2049 |
const guildId = interaction.guildId;
|
| 2050 |
guildSelectedFormation.set(guildId, interaction.values[0]);
|
| 2051 |
const map = new Map();
|
|
@@ -2114,12 +2126,13 @@ if (interaction.commandName === 'lineup') {
|
|
| 2114 |
if (!lineupBoard.get(pos)) lineupBoard.set(pos, []);
|
| 2115 |
lineupBoard.get(pos).push(userId);
|
| 2116 |
}
|
| 2117 |
-
|
| 2118 |
-
|
| 2119 |
-
|
| 2120 |
-
|
|
|
|
| 2121 |
|
| 2122 |
-
|
| 2123 |
if (!roleStorage.isWhitelisted(interaction.guildId, interaction.member)) return sendNoPermission(interaction);
|
| 2124 |
|
| 2125 |
const ownerId = lineupOwners.get(interaction.guildId);
|
|
@@ -2127,13 +2140,14 @@ if (interaction.commandName === 'lineup') {
|
|
| 2127 |
return interaction.reply({ content: `❌ Only <@${ownerId}> can clear the board!`, ephemeral: true });
|
| 2128 |
}
|
| 2129 |
|
| 2130 |
-
|
| 2131 |
-
|
| 2132 |
-
|
| 2133 |
-
|
| 2134 |
-
|
|
|
|
| 2135 |
|
| 2136 |
-
|
| 2137 |
if (!roleStorage.isWhitelisted(interaction.guildId, interaction.member)) {
|
| 2138 |
return sendNoPermission(interaction);
|
| 2139 |
}
|
|
|
|
| 34 |
const server = require('./server');
|
| 35 |
console.log(">>> [BOOT] Web Server module loaded.");
|
| 36 |
|
| 37 |
+
const { guildLineups, guildSelectedFormation, lineupOwners, activeLineupMessages, managerBoards, guildCustomFormations, guildCustomFormationNames, guildPingType, guildFriendlyPingType, guildScrimMode, save: saveLineup } = require('./lineup_persistence');
|
| 38 |
const guildActiveCategory = new Map(); // Stores the currently selected category in the UI for each guild
|
| 39 |
|
| 40 |
try {
|
|
|
|
| 514 |
return;
|
| 515 |
}
|
| 516 |
|
| 517 |
+
if (commandName === 'lineup') {
|
| 518 |
+
if (!roleStorage.isWhitelisted(message.guildId, message.member)) return sendNoPermission(message);
|
| 519 |
|
| 520 |
+
const mentionArg = args[0] ? args[0].toLowerCase().replace('@', '') : null;
|
| 521 |
+
const pingType = mentionArg === 'here' ? 'here' : 'everyone';
|
| 522 |
+
guildPingType.set(message.guildId, pingType);
|
| 523 |
|
| 524 |
+
lineupOwners.set(message.guildId, message.author.id);
|
| 525 |
+
guildScrimMode.set(message.guildId, false); // Clear scrim mode
|
| 526 |
+
saveLineup();
|
| 527 |
|
| 528 |
+
// Clear lineup before showing to ensure no names in it
|
| 529 |
+
const lineup = getGuildLineup(message.guildId);
|
| 530 |
+
lineup.clear();
|
| 531 |
+
saveLineup();
|
| 532 |
|
| 533 |
+
// Show lineup immediately without waiting for reactions
|
| 534 |
+
console.log(`[DEBUG] LINEUP-MSG: guild=${message.guildId} pingType=${pingType} owner=${message.author?.id || 'unknown'}`);
|
| 535 |
const view = createLineupView(message.guildId);
|
| 536 |
const msg = await message.channel.send(view);
|
| 537 |
activeLineupMessages.set(message.guildId, { channelId: message.channelId, messageId: msg.id });
|
| 538 |
addToCleanupQueue(message.guildId, message.channelId, msg.id, 'lineup');
|
| 539 |
return;
|
| 540 |
+
}
|
| 541 |
|
| 542 |
+
if (commandName === 'scrimlineup') {
|
| 543 |
if (!roleStorage.isWhitelisted(message.guildId, message.member)) return sendNoPermission(message);
|
| 544 |
|
| 545 |
const mentionArg = args[0] ? args[0].toLowerCase().replace('@', '') : null;
|
|
|
|
| 547 |
guildPingType.set(message.guildId, pingType);
|
| 548 |
|
| 549 |
lineupOwners.set(message.guildId, message.author.id);
|
| 550 |
+
guildScrimMode.set(message.guildId, true); // Set scrim mode
|
| 551 |
saveLineup();
|
| 552 |
|
| 553 |
const lineup = getGuildLineup(message.guildId);
|
|
|
|
| 560 |
activeLineupMessages.set(message.guildId, { channelId: message.channelId, messageId: msg.id });
|
| 561 |
addToCleanupQueue(message.guildId, message.channelId, msg.id, 'lineup');
|
| 562 |
return;
|
| 563 |
+
}
|
| 564 |
|
| 565 |
if (commandName === 'top') {
|
| 566 |
const sorted = Object.entries(storage.data.stats).sort((a, b) => (b[1].matches || 0) - (a[1].matches || 0)).slice(0, 10);
|
|
|
|
| 848 |
await message.reply(`✅ Swapped <@${p1.id}> with <@${p2.id}>!`);
|
| 849 |
|
| 850 |
// Update the board
|
| 851 |
+
const boardInfo = activeLineupMessages.get(message.guildId);
|
| 852 |
+
if (boardInfo) {
|
| 853 |
+
try {
|
| 854 |
+
const channel = await client.channels.fetch(boardInfo.channelId);
|
| 855 |
+
const msg = await channel.messages.fetch(boardInfo.messageId);
|
| 856 |
+
const isScrim = guildScrimMode.get(message.guildId) === true;
|
| 857 |
+
if (msg) await msg.edit(isScrim ? createScrimLineupView(message.guildId) : createLineupView(message.guildId));
|
| 858 |
+
} catch (e) {}
|
| 859 |
+
}
|
| 860 |
+
return;
|
| 861 |
+
}
|
| 862 |
|
| 863 |
if (commandName === 'sync' || commandName === 'sync_cmds') {
|
| 864 |
if (!message.member.permissions.has('Administrator')) return;
|
|
|
|
| 1504 |
guildPingType.set(interaction.guildId, pingType);
|
| 1505 |
|
| 1506 |
lineupOwners.set(interaction.guildId, interaction.user.id);
|
| 1507 |
+
guildScrimMode.set(interaction.guildId, false); // Clear scrim mode
|
| 1508 |
saveLineup();
|
| 1509 |
const row1 = new ActionRowBuilder().addComponents(
|
| 1510 |
new StringSelectMenuBuilder()
|
|
|
|
| 1547 |
guildPingType.set(interaction.guildId, pingType);
|
| 1548 |
|
| 1549 |
lineupOwners.set(interaction.guildId, interaction.user.id);
|
| 1550 |
+
guildScrimMode.set(interaction.guildId, true); // Set scrim mode
|
| 1551 |
saveLineup();
|
| 1552 |
|
| 1553 |
const lineup = getGuildLineup(interaction.guildId);
|
|
|
|
| 1633 |
|
| 1634 |
await safeReply(interaction, { content: `✅ Swapped <@${p1.id}> with <@${p2.id}>!`, flags: [MessageFlags.Ephemeral] });
|
| 1635 |
|
| 1636 |
+
// Update the board
|
| 1637 |
+
const boardInfo = activeLineupMessages.get(interaction.guildId);
|
| 1638 |
+
if (boardInfo) {
|
| 1639 |
+
try {
|
| 1640 |
+
const channel = await client.channels.fetch(boardInfo.channelId);
|
| 1641 |
+
const msg = await channel.messages.fetch(boardInfo.messageId);
|
| 1642 |
+
const isScrim = guildScrimMode.get(interaction.guildId) === true;
|
| 1643 |
+
if (msg) await msg.edit(isScrim ? createScrimLineupView(interaction.guildId) : createLineupView(interaction.guildId));
|
| 1644 |
+
} catch (e) {}
|
| 1645 |
+
}
|
| 1646 |
+
}
|
| 1647 |
|
| 1648 |
if (interaction.commandName === 'sendlink') {
|
| 1649 |
if (!roleStorage.isWhitelisted(interaction.guildId, interaction.member)) return safeReply(interaction, { content: "❌ No Permission", flags: [MessageFlags.Ephemeral] });
|
|
|
|
| 1898 |
const tempKey = `custom_${guildId}`;
|
| 1899 |
guildSelectedFormation.set(guildId, tempKey);
|
| 1900 |
|
| 1901 |
+
// Clear current lineup as formation changed
|
| 1902 |
+
const map = new Map();
|
| 1903 |
+
guildLineups.set(guildId, map);
|
| 1904 |
+
saveLineup();
|
| 1905 |
|
| 1906 |
+
const isScrim = guildScrimMode.get(guildId) === true;
|
| 1907 |
+
const view = isScrim ? createScrimLineupView(guildId) : createLineupView(guildId);
|
| 1908 |
|
| 1909 |
+
// If the modal was triggered from a message (like the initial setup message), update it!
|
| 1910 |
if (interaction.message) {
|
| 1911 |
await interaction.update(view);
|
| 1912 |
activeLineupMessages.set(guildId, { channelId: interaction.channelId, messageId: interaction.message.id });
|
|
|
|
| 1933 |
}
|
| 1934 |
}
|
| 1935 |
|
| 1936 |
+
if (interaction.isStringSelectMenu() && interaction.customId.startsWith('formation_select_initial_')) {
|
| 1937 |
+
if (!roleStorage.isWhitelisted(interaction.guildId, interaction.member)) return sendNoPermission(interaction);
|
| 1938 |
|
| 1939 |
+
const ownerId = lineupOwners.get(interaction.guildId);
|
| 1940 |
+
if (ownerId && interaction.user.id !== ownerId) {
|
| 1941 |
+
return interaction.reply({ content: `❌ Only <@${ownerId}> can initialize this lineup!`, ephemeral: true });
|
| 1942 |
+
}
|
| 1943 |
|
| 1944 |
+
const guildId = interaction.guildId;
|
| 1945 |
+
const formKey = interaction.values[0];
|
| 1946 |
+
guildSelectedFormation.set(guildId, formKey);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1947 |
|
| 1948 |
+
// Clear current lineup as formation changed
|
| 1949 |
+
const map = new Map();
|
| 1950 |
+
guildLineups.set(guildId, map);
|
| 1951 |
+
saveLineup();
|
| 1952 |
|
| 1953 |
+
// Check if in scrim mode
|
| 1954 |
+
const isScrim = guildScrimMode.get(guildId) === true;
|
| 1955 |
+
const view = isScrim ? createScrimLineupView(guildId) : createLineupView(guildId);
|
| 1956 |
+
await interaction.update(view);
|
| 1957 |
+
|
| 1958 |
+
activeLineupMessages.set(guildId, { channelId: interaction.channelId, messageId: interaction.message.id });
|
| 1959 |
+
addToCleanupQueue(guildId, interaction.channelId, interaction.message.id, 'lineup');
|
| 1960 |
+
saveLineup();
|
| 1961 |
+
return;
|
| 1962 |
+
}
|
| 1963 |
|
| 1964 |
if (interaction.isStringSelectMenu() && interaction.customId === 'formation_category_select') {
|
| 1965 |
if (!roleStorage.isWhitelisted(interaction.guildId, interaction.member)) return sendNoPermission(interaction);
|
|
|
|
| 2009 |
guildLineups.set(guildId, map);
|
| 2010 |
saveLineup();
|
| 2011 |
|
| 2012 |
+
await interaction.update({ content: `✅ Updated public board to **${formKey}**!`, components: [] });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2013 |
|
| 2014 |
+
try {
|
| 2015 |
+
const channel = interaction.channel;
|
| 2016 |
+
const publicMsg = await channel.messages.fetch(publicMessageId);
|
| 2017 |
+
const isScrim = guildScrimMode.get(guildId) === true;
|
| 2018 |
+
await publicMsg.edit(isScrim ? createScrimLineupView(guildId) : createLineupView(guildId));
|
| 2019 |
+
} catch (e) {
|
| 2020 |
+
console.error("[!] Failed to update public board from ephemeral menu:", e.message);
|
| 2021 |
+
}
|
| 2022 |
+
return;
|
| 2023 |
+
}
|
| 2024 |
+
|
| 2025 |
+
if (interaction.isStringSelectMenu() && interaction.customId === 'formation_select_active') {
|
| 2026 |
+
if (!roleStorage.isWhitelisted(interaction.guildId, interaction.member)) return sendNoPermission(interaction);
|
| 2027 |
+
const ownerId = lineupOwners.get(interaction.guildId);
|
| 2028 |
+
if (ownerId && interaction.user.id !== ownerId) {
|
| 2029 |
+
return interaction.reply({ content: `❌ Only <@${ownerId}> can change the formation!`, ephemeral: true });
|
| 2030 |
+
}
|
| 2031 |
+
const guildId = interaction.guildId;
|
| 2032 |
+
guildSelectedFormation.set(guildId, interaction.values[0]);
|
| 2033 |
+
const map = new Map();
|
| 2034 |
+
guildLineups.set(guildId, map);
|
| 2035 |
+
const isScrim = guildScrimMode.get(guildId) === true;
|
| 2036 |
+
await interaction.update(isScrim ? createScrimLineupView(guildId) : createLineupView(guildId));
|
| 2037 |
+
saveLineup();
|
| 2038 |
+
return;
|
| 2039 |
+
}
|
| 2040 |
|
| 2041 |
if (interaction.isStringSelectMenu() && interaction.customId.startsWith('formation_select_')) {
|
| 2042 |
if (interaction.customId.includes('_initial_') || interaction.customId.includes('_active')) return;
|
|
|
|
| 2047 |
return interaction.reply({ content: `❌ Only <@${ownerId}> can change the formation!`, ephemeral: true });
|
| 2048 |
}
|
| 2049 |
|
| 2050 |
+
const guildId = interaction.guildId;
|
| 2051 |
+
guildSelectedFormation.set(guildId, interaction.values[0]);
|
| 2052 |
+
const map = new Map();
|
| 2053 |
+
guildLineups.set(guildId, map);
|
| 2054 |
+
const isScrim = guildScrimMode.get(guildId) === true;
|
| 2055 |
+
await interaction.update(isScrim ? createScrimLineupView(guildId) : createLineupView(guildId));
|
| 2056 |
+
saveLineup();
|
| 2057 |
+
return;
|
| 2058 |
+
}
|
| 2059 |
|
| 2060 |
+
if (interaction.isStringSelectMenu() && interaction.customId.startsWith('manager_formation_select_')) {
|
| 2061 |
const guildId = interaction.guildId;
|
| 2062 |
guildSelectedFormation.set(guildId, interaction.values[0]);
|
| 2063 |
const map = new Map();
|
|
|
|
| 2126 |
if (!lineupBoard.get(pos)) lineupBoard.set(pos, []);
|
| 2127 |
lineupBoard.get(pos).push(userId);
|
| 2128 |
}
|
| 2129 |
+
saveLineup();
|
| 2130 |
+
const isScrim = guildScrimMode.get(lineupGuildId) === true;
|
| 2131 |
+
await interaction.editReply(isScrim ? createScrimLineupView(lineupGuildId) : createLineupView(lineupGuildId));
|
| 2132 |
+
return;
|
| 2133 |
+
}
|
| 2134 |
|
| 2135 |
+
if (interaction.customId === 'lineup_clear') {
|
| 2136 |
if (!roleStorage.isWhitelisted(interaction.guildId, interaction.member)) return sendNoPermission(interaction);
|
| 2137 |
|
| 2138 |
const ownerId = lineupOwners.get(interaction.guildId);
|
|
|
|
| 2140 |
return interaction.reply({ content: `❌ Only <@${ownerId}> can clear the board!`, ephemeral: true });
|
| 2141 |
}
|
| 2142 |
|
| 2143 |
+
lineupBoard.clear();
|
| 2144 |
+
saveLineup();
|
| 2145 |
+
const isScrim = guildScrimMode.get(lineupGuildId) === true;
|
| 2146 |
+
await interaction.update(isScrim ? createScrimLineupView(lineupGuildId) : createLineupView(lineupGuildId));
|
| 2147 |
+
return;
|
| 2148 |
+
}
|
| 2149 |
|
| 2150 |
+
if (interaction.customId === 'lineup_done') {
|
| 2151 |
if (!roleStorage.isWhitelisted(interaction.guildId, interaction.member)) {
|
| 2152 |
return sendNoPermission(interaction);
|
| 2153 |
}
|