discord-optimizer
Version:
Reduce Discord.js bot RAM usage with automatic optimization and restart capabilities
41 lines • 1.42 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.sendWebhookAlert = sendWebhookAlert;
async function sendWebhookAlert(webhookUrl, data) {
if (!webhookUrl)
return;
try {
const payload = {
embeds: [{
title: "Discord Optimizer Alert",
description: data.message,
color: data.type === 'warning' ? 0xFFA500 : 0xFF0000,
fields: [
{
name: "Memory Usage",
value: `${data.usage.heapUsed}MB / ${data.maxMemory}MB`,
inline: true
},
{
name: "Action Taken",
value: data.action,
inline: true
}
],
timestamp: new Date().toISOString()
}]
};
const response = await fetch(webhookUrl, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(payload)
});
if (!response.ok) {
console.error('Webhook failed:', response.statusText);
}
}
catch (error) {
console.error('Webhook error:', error);
}
}
//# sourceMappingURL=webhook.js.map