Easily trade all your votes with this super easy framework!
- Install module:
npm i topgg-votes
- Put the following in your index.ts:
import { VoteClient, VoteClientEvents } from 'topgg-votes'
const votesClient = new VoteClient({
token: "TOKEN",
webhook: {
port: 22565,
path: "/dblwebhook",
authorization: "WEBHOOK"
}
})
// Event for vote notifications
votesClient.on(VoteClientEvents.BotVote, ({ userId }) => {
console.log(`${userId} has voted!`)
})
votesClient.hasVoted(interaction.user.id).then(voted => {
if (voted) {
console.log("User has voted!");
}
if (!voted) {
console.log("User has not voted!");
}
})
const votesClient = new VoteClient()
.setToken("TOKEN") // Your top.gg token
.setWebhookPort(22565) // Your host port
.setWebhookPath("/dblwebhook") // Webhook path
.setWebhookAuthorization("DOTWOODJS") // Webhook password
votesClient.on(VoteClientEvents.BotVote, ({ userId, botId, isWeekend, type }) => {
let embed = new Discord.EmbedBuilder()
.setTitle(`New bot vote!!`)
.addFields([
{
name: 'User',
value: `<@!${userId}>`,
inline: true
},
{
name: 'Bot',
value: `<@!${botId}>`,
inline: true
},
{
name: 'Weekend',
value: `${isWeekend}`,
inline: true
},
{
name: 'Type',
value: `${type}`,
inline: true
}
])
client.channels.cache.get(ID).send({ embeds: [embed] });
// Enter the ID of the logs channel at ID
})
votesClient.on(VoteClientEvents.ServerVote, ({ userId, guildId, type }) => {
let embed = new Discord.EmbedBuilder()
.setTitle(`New server vote!!`)
.addFields([
{
name: 'User',
value: `<@!${userId}>`,
inline: true
},
{
name: 'Guild',
value: `<@!${guildId}>`,
inline: true
},
{
name: 'Type',
value: `${type}`,
inline: true
}
])
client.channels.cache.get(ID).send({ embeds: [embed] });
// Enter the ID of the logs channel at ID
})
votesClient.getVotes()
votesClient.getBot(BOTID) // Replace BOTID with Discord bot id
votesClient.getUser(USERID) // Replace USERID with Discord user id
This project has an Apache 2.0 license