diff --git a/src/DjsHandlers.js b/src/DjsHandlers.js index 3d439ad..503ceb4 100644 --- a/src/DjsHandlers.js +++ b/src/DjsHandlers.js @@ -41,7 +41,7 @@ module.exports = { embeds: [embed] }); }, - topgg(body) { + topggVote(body) { console.log(body); // Create a new WebhookClient const webhookClient = new WebhookClient({ id: whInfo.topgg.id, token: whInfo.topgg.token }); @@ -49,14 +49,31 @@ module.exports = { // Create a new EmbedBuilder const embed = new EmbedBuilder() .setTitle('Top.gg Vote') - .setDescription(`User ID: ${body.user}`) + .setDescription(`<@${body.user}> voted for Silvanus on top.gg, thanks!\n\n[Vote Here](https://top.gg/bot/521624335119810561/vote)`) .setTimestamp(); // Send the Embed webhookClient.send({ - content: 'A user has voted for the bot on top.gg', username: config.discord.topgg.username, embeds: [embed] }); + }, + uptimeKumaAlert(body) { + console.log(body); + // Create a new WebhookClient + const webhookClient = new WebhookClient({ id: whInfo.uptimeKuma.id, token: whInfo.uptimeKuma.token }); + + // Create a new EmbedBuilder + const embed = new EmbedBuilder() + .setTitle('Uptime Kuma Alert') + .setDescription(`Service: ${body.service}`) + .setTimestamp(); + + // Send the Embed + webhookClient.send({ + content: 'Uptime Kuma has detected an issue with a service', + username: config.discord.uptimeKuma.username, + embeds: [embed] + }); } } \ No newline at end of file diff --git a/src/Handlers.js b/src/Handlers.js index f38eac4..6b33eb9 100644 --- a/src/Handlers.js +++ b/src/Handlers.js @@ -11,12 +11,12 @@ module.exports = { // Handle top.gg vote webhook payload here console.log('Received top.gg vote webhook payload:', req.body); res.sendStatus(200); - djs.topggVote(); + djs.topggVote(req.body); }, uptimeKuma(req, res) { // Handle Uptime Kuma webhook payload here console.log('Received Uptime Kuma webhook payload:', req.body); res.sendStatus(200); - djs.uptimeKumaAlert(); + djs.uptimeKumaAlert(req.body); } } \ No newline at end of file diff --git a/src/config.json b/src/config.json index 1da0305..cb9b81c 100644 --- a/src/config.json +++ b/src/config.json @@ -4,7 +4,7 @@ "username": "HookShot Test System" }, "topgg": { - "username": "Silvanus votes on Top.gg" + "username": "Silvanus Votes on Top.gg" }, "uptimeKuma": { "username": "Silvanus Uptime Monitor"