mirror of
https://github.com/JonnyBro/JaBa.git
synced 2024-11-23 05:34:58 +05:00
41 lines
No EOL
1.2 KiB
JavaScript
41 lines
No EOL
1.2 KiB
JavaScript
const DBL = require("dblapi.js");
|
|
|
|
/* THIS POSTS STATS TO DISCORDBOTS.ORG */
|
|
module.exports = {
|
|
/**
|
|
* Starts to post stats to DBL
|
|
* @param {object} client The Discord Client instance
|
|
*/
|
|
init(client) {
|
|
if (client.config.apiKeys.dbl && client.config.apiKeys.dbl !== "") {
|
|
const stats = new DBL(client.config.apiKeys.dbl, client);
|
|
setInterval(function () {
|
|
stats.postStats(client.guilds.cache.size);
|
|
}, 10 * 60000); // every 10 minutes
|
|
const dbl = new DBL(client.config.apiKeys.dbl, {
|
|
webhookPort: client.config.votes.port,
|
|
webhookAuth: client.config.votes.password
|
|
});
|
|
dbl.webhook.on("vote", async (vote) => {
|
|
const dUser = await client.users.fetch(vote.user);
|
|
const member = await client.findOrCreateMember({
|
|
id: vote.user,
|
|
guildID: client.config.support.id
|
|
});
|
|
member.money = member.money + 50;
|
|
member.save();
|
|
dUser.send(client.translate("misc:VOTE_DM", {
|
|
user: dUser.tag
|
|
})).catch(() => {});
|
|
const logsChannel = client.channels.cache.get(client.config.votes.channel);
|
|
|
|
if (logsChannel) logsChannel.send({
|
|
content: client.translate("misc:VOTE_LOGS", {
|
|
userid: dUser.id,
|
|
usertag: dUser.tag
|
|
})
|
|
});
|
|
});
|
|
};
|
|
}
|
|
}; |