Spaces:
Runtime error
Runtime error
Update index.js
Browse files
index.js
CHANGED
|
@@ -534,25 +534,11 @@ client.on('messageCreate', async (message) => {
|
|
| 534 |
lineup.clear();
|
| 535 |
saveLineup();
|
| 536 |
|
| 537 |
-
// Show lineup immediately
|
| 538 |
console.log(`[DEBUG] LINEUP-MSG: guild=${message.guildId} pingType=${pingType} owner=${message.author?.id || 'unknown'}`);
|
| 539 |
const view = createLineupView(message.guildId);
|
| 540 |
-
|
| 541 |
-
|
| 542 |
-
const existingInfo = activeLineupMessages.get(message.guildId);
|
| 543 |
-
if (existingInfo) {
|
| 544 |
-
try {
|
| 545 |
-
const targetChannel = await client.channels.fetch(existingInfo.channelId).catch(() => null);
|
| 546 |
-
const existing = targetChannel ? await targetChannel.messages.fetch(existingInfo.messageId).catch(() => null) : null;
|
| 547 |
-
if (existing) {
|
| 548 |
-
await existing.edit(view).catch(() => null);
|
| 549 |
-
lineupMsg = existing;
|
| 550 |
-
}
|
| 551 |
-
} catch (_) { /* ignore */ }
|
| 552 |
-
}
|
| 553 |
-
if (!lineupMsg) {
|
| 554 |
-
lineupMsg = await message.channel.send(view);
|
| 555 |
-
}
|
| 556 |
activeLineupMessages.set(message.guildId, { channelId: message.channelId, messageId: lineupMsg.id });
|
| 557 |
addToCleanupQueue(message.guildId, message.channelId, lineupMsg.id, 'lineup');
|
| 558 |
return;
|
|
@@ -575,14 +561,11 @@ client.on('messageCreate', async (message) => {
|
|
| 575 |
lineupB.clear();
|
| 576 |
saveLineup();
|
| 577 |
|
| 578 |
-
console.log(`[DEBUG] SCRIMLINEUP-MSG: guild=${message.guildId} pingType=${pingType} owner=${message.author?.id || 'unknown'}`);
|
| 579 |
try {
|
| 580 |
const view = createScrimLineupView(message.guildId);
|
| 581 |
-
|
| 582 |
-
|
| 583 |
-
|
| 584 |
-
activeLineupMessages.set(message.guildId, { channelId: message.channelId, messageId: msg.id });
|
| 585 |
-
addToCleanupQueue(message.guildId, message.channelId, msg.id, 'lineup');
|
| 586 |
} catch (err) {
|
| 587 |
console.error(`[DEBUG] Error in !scrimlineup command:`, err);
|
| 588 |
}
|
|
|
|
| 534 |
lineup.clear();
|
| 535 |
saveLineup();
|
| 536 |
|
| 537 |
+
// Show lineup immediately as a fresh message for maximum speed
|
| 538 |
console.log(`[DEBUG] LINEUP-MSG: guild=${message.guildId} pingType=${pingType} owner=${message.author?.id || 'unknown'}`);
|
| 539 |
const view = createLineupView(message.guildId);
|
| 540 |
+
|
| 541 |
+
const lineupMsg = await message.channel.send(view);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 542 |
activeLineupMessages.set(message.guildId, { channelId: message.channelId, messageId: lineupMsg.id });
|
| 543 |
addToCleanupQueue(message.guildId, message.channelId, lineupMsg.id, 'lineup');
|
| 544 |
return;
|
|
|
|
| 561 |
lineupB.clear();
|
| 562 |
saveLineup();
|
| 563 |
|
|
|
|
| 564 |
try {
|
| 565 |
const view = createScrimLineupView(message.guildId);
|
| 566 |
+
const lineupMsg = await message.channel.send(view);
|
| 567 |
+
activeLineupMessages.set(message.guildId, { channelId: message.channelId, messageId: lineupMsg.id });
|
| 568 |
+
addToCleanupQueue(message.guildId, message.channelId, lineupMsg.id, 'lineup');
|
|
|
|
|
|
|
| 569 |
} catch (err) {
|
| 570 |
console.error(`[DEBUG] Error in !scrimlineup command:`, err);
|
| 571 |
}
|