topgg-vote-receiver
v1.0.0
Published
A top.gg vote receiver which listens to votes on a bot.
Downloads
9
Maintainers
Readme
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.
vote
is 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
Webhooks
page of the edit bot page. - port (number): The port to listen on for the express app.
VoteListener.handleVotes()
This will start the webhook server.