TopGG Working

This commit is contained in:
Skylar Grant 2024-09-22 14:37:08 -04:00
parent 4ce75dd629
commit 656123926e
3 changed files with 23 additions and 6 deletions

View File

@ -41,7 +41,7 @@ module.exports = {
embeds: [embed] embeds: [embed]
}); });
}, },
topgg(body) { topggVote(body) {
console.log(body); console.log(body);
// Create a new WebhookClient // Create a new WebhookClient
const webhookClient = new WebhookClient({ id: whInfo.topgg.id, token: whInfo.topgg.token }); const webhookClient = new WebhookClient({ id: whInfo.topgg.id, token: whInfo.topgg.token });
@ -49,14 +49,31 @@ module.exports = {
// Create a new EmbedBuilder // Create a new EmbedBuilder
const embed = new EmbedBuilder() const embed = new EmbedBuilder()
.setTitle('Top.gg Vote') .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(); .setTimestamp();
// Send the Embed // Send the Embed
webhookClient.send({ webhookClient.send({
content: 'A user has voted for the bot on top.gg',
username: config.discord.topgg.username, username: config.discord.topgg.username,
embeds: [embed] 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]
});
} }
} }

View File

@ -11,12 +11,12 @@ module.exports = {
// Handle top.gg vote webhook payload here // Handle top.gg vote webhook payload here
console.log('Received top.gg vote webhook payload:', req.body); console.log('Received top.gg vote webhook payload:', req.body);
res.sendStatus(200); res.sendStatus(200);
djs.topggVote(); djs.topggVote(req.body);
}, },
uptimeKuma(req, res) { uptimeKuma(req, res) {
// Handle Uptime Kuma webhook payload here // Handle Uptime Kuma webhook payload here
console.log('Received Uptime Kuma webhook payload:', req.body); console.log('Received Uptime Kuma webhook payload:', req.body);
res.sendStatus(200); res.sendStatus(200);
djs.uptimeKumaAlert(); djs.uptimeKumaAlert(req.body);
} }
} }

View File

@ -4,7 +4,7 @@
"username": "HookShot Test System" "username": "HookShot Test System"
}, },
"topgg": { "topgg": {
"username": "Silvanus votes on Top.gg" "username": "Silvanus Votes on Top.gg"
}, },
"uptimeKuma": { "uptimeKuma": {
"username": "Silvanus Uptime Monitor" "username": "Silvanus Uptime Monitor"