Spaces:
Runtime error
Runtime error
Update index.js
Browse files
index.js
CHANGED
|
@@ -626,17 +626,24 @@ client.on('messageCreate', async (message) => {
|
|
| 626 |
|
| 627 |
if (commandName === 'checkbroadcast') {
|
| 628 |
const history = broadcastSystem.getBroadcastHistory();
|
| 629 |
-
|
| 630 |
|
| 631 |
-
|
| 632 |
-
history.
|
| 633 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 634 |
});
|
| 635 |
|
| 636 |
const embed = new EmbedBuilder()
|
| 637 |
-
.setTitle("Broadcast
|
| 638 |
.setDescription(report)
|
| 639 |
-
.setColor('#5865F2')
|
|
|
|
| 640 |
await message.reply({ embeds: [embed] });
|
| 641 |
}
|
| 642 |
}
|
|
|
|
| 626 |
|
| 627 |
if (commandName === 'checkbroadcast') {
|
| 628 |
const history = broadcastSystem.getBroadcastHistory();
|
| 629 |
+
const sevenDaysAgo = Date.now() - (7 * 24 * 60 * 60 * 1000);
|
| 630 |
|
| 631 |
+
// Filter history for messages sent in the last 7 days
|
| 632 |
+
const recentHistory = history.filter(b => new Date(b.timestamp).getTime() > sevenDaysAgo);
|
| 633 |
+
|
| 634 |
+
if (recentHistory.length === 0) return message.reply("📜 No broadcast history found from the last 7 days.");
|
| 635 |
+
|
| 636 |
+
let report = "📜 **BROADCAST HISTORY (Last 7 Days)**\n\n";
|
| 637 |
+
recentHistory.slice(-15).forEach(b => {
|
| 638 |
+
const date = new Date(b.timestamp);
|
| 639 |
+
report += `🆔 **${b.id}** | 👤 **${b.senderTag}**\n📝 *${b.content.substring(0, 50)}${b.content.length > 50 ? '...' : ''}*\n📅 ${date.toLocaleString()} | 🌍 \`${b.messages.length}\` servers\n\n`;
|
| 640 |
});
|
| 641 |
|
| 642 |
const embed = new EmbedBuilder()
|
| 643 |
+
.setTitle("Broadcast Audit Log")
|
| 644 |
.setDescription(report)
|
| 645 |
+
.setColor('#5865F2')
|
| 646 |
+
.setFooter({ text: `Showing last ${Math.min(recentHistory.length, 15)} broadcasts` });
|
| 647 |
await message.reply({ embeds: [embed] });
|
| 648 |
}
|
| 649 |
}
|