1.0.0 • Published 4 years ago
topgg-vote-receiver v1.0.0
topgg-vote-receiver
A top.gg vote receiver which listens to votes for a bot.
Example
const VoteListener = require('topgg-vote-receiver');
const vote = new VoteListener({
auth: 'topggauth123',
port: 3000,
});
vote.handleVotes();
vote.on('voted', (vote) => {
console.log(vote);
});
console.log(`Listening on 3000`);Events
- 'voted' (vote) - Emitted when a user votes for the bot.
voteis an object which contains info of the user who voted and other details.
API
VoteListener.constructor(options)
options is an object which should contain the auth and the port:
- auth (string): The webhook authorization token for the top.gg webhook. Can be found at the
Webhookspage of the edit bot page. - port (number): The port to listen on for the express app.
VoteListener.handleVotes()
This will start the webhook server.
Your webhook dashboard should look something like this (if using the example above):
1.0.0
4 years ago