Spaces:
Runtime error
Runtime error
Update index.js
Browse files
index.js
CHANGED
|
@@ -1313,20 +1313,19 @@ client.on('interactionCreate', async (interaction) => {
|
|
| 1313 |
guildLineups.set(guildId, map);
|
| 1314 |
saveLineup();
|
| 1315 |
|
| 1316 |
-
|
| 1317 |
-
|
| 1318 |
-
//
|
| 1319 |
-
|
| 1320 |
-
|
| 1321 |
-
|
| 1322 |
-
|
| 1323 |
-
const msg = await channel.messages.fetch(boardInfo.messageId);
|
| 1324 |
-
if (msg) await msg.edit(createLineupView(guildId));
|
| 1325 |
-
} catch (e) { }
|
| 1326 |
} else {
|
| 1327 |
-
//
|
| 1328 |
-
|
| 1329 |
-
await interaction.channel.send(view);
|
|
|
|
|
|
|
| 1330 |
}
|
| 1331 |
return;
|
| 1332 |
}
|
|
|
|
| 1313 |
guildLineups.set(guildId, map);
|
| 1314 |
saveLineup();
|
| 1315 |
|
| 1316 |
+
const view = createLineupView(guildId);
|
| 1317 |
+
|
| 1318 |
+
// If the modal was triggered from a message (like the initial setup message), update it!
|
| 1319 |
+
if (interaction.message) {
|
| 1320 |
+
await interaction.update(view);
|
| 1321 |
+
activeLineupMessages.set(guildId, { channelId: interaction.channelId, messageId: interaction.message.id });
|
| 1322 |
+
addToCleanupQueue(guildId, interaction.channelId, interaction.message.id, 'lineup');
|
|
|
|
|
|
|
|
|
|
| 1323 |
} else {
|
| 1324 |
+
// Otherwise reply ephemerally and send a new message
|
| 1325 |
+
await interaction.reply({ content: `✅ Formation set to **${formName}**!`, ephemeral: true });
|
| 1326 |
+
const msg = await interaction.channel.send(view);
|
| 1327 |
+
activeLineupMessages.set(guildId, { channelId: interaction.channelId, messageId: msg.id });
|
| 1328 |
+
addToCleanupQueue(guildId, interaction.channelId, msg.id, 'lineup');
|
| 1329 |
}
|
| 1330 |
return;
|
| 1331 |
}
|