topgg-vote-receiver

1.0.0 • Public • Published

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

  1. '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:

  1. auth (string): The webhook authorization token for the top.gg webhook. Can be found at the Webhooks page of the edit bot page.
  2. 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):

Package Sidebar

Install

npm i topgg-vote-receiver

Weekly Downloads

3

Version

1.0.0

License

MIT

Unpacked Size

4.09 kB

Total Files

4

Last publish

Collaborators

  • fc5570