2.2.1 • Published 9 months ago
topgg-votes v2.2.1
Topgg-votes
Easily trade all your votes with this super easy framework!
💻 Installation
- 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!`)
})
📨 Check votes
votesClient.hasVoted(interaction.user.id).then(voted => {
if (voted) {
console.log("User has voted!");
}
if (!voted) {
console.log("User has not voted!");
}
})
📂 Other examples
Change client
const votesClient = new VoteClient()
.setToken("TOKEN") // Your top.gg token
.setWebhookPort(22565) // Your host port
.setWebhookPath("/dblwebhook") // Webhook path
.setWebhookAuthorization("DOTWOODJS") // Webhook password
New bot vote event
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
})
New server vote event
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
})
Get votes
votesClient.getVotes()
Get bot
votesClient.getBot(BOTID) // Replace BOTID with Discord bot id
Get user
votesClient.getUser(USERID) // Replace USERID with Discord user id
📑 License
This project has an Apache 2.0 license
2.1.1-test-9f1f69de7b21.0
9 months ago
2.1.1-test-a81d674b7033.0
9 months ago
2.1.1-test-d0efd3e23aa8.0
9 months ago
2.2.1
9 months ago
2.2.0
9 months ago
2.1.1-test-dc21728252cb.0
9 months ago
2.1.0
1 year ago
2.0.5-dev
1 year ago
2.0.1-dev
1 year ago
2.0.2-dev
1 year ago
2.0.4-dev
1 year ago
2.0.0-dev
1 year ago
2.0.3-dev
1 year ago
2.0.1
1 year ago
2.0.0
1 year ago
1.3.1-dev.0
3 years ago
1.3.0
3 years ago
1.2.0
3 years ago
1.1.0
3 years ago
1.0.0
3 years ago