npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

vote-tracker-test

v6.0.0

Published

A professional npm package for tracking votes

Downloads

2

Readme

Table of contents

Vote Tracker

Vote Tracker is an npm package designed to track votes on Discord bots from top.gg and log them to a specified Discord channel.

About

  • Support TypeScript
  • 100% Customizable
  • Easy to setup

Installation

You can install the package via npm:

npm install vote-tracker

Usage

To use the package, follow these steps:

Common Js

const { Client, GatewayIntentBits } = require('discord.js');
const VoteTracker = require('vote-tracker');

// Create a Discord.js client
const client = new Client({
    intents: [
      GatewayIntentBits.Guilds,
      GatewayIntentBits.GuildMembers,
      GatewayIntentBits.GuildMessages,
      GatewayIntentBits.MessageContent
    ]
})

// Initialize VoteTracker with client instance and options
const voteTracker = new VoteTracker(client, {
    guildId: 'YOUR_GUILD_ID',
    roleId: 'YOUR_ROLE_ID', // Optional: specify role id
    channelId: 'YOUR_VOTE_LOG_CHANNEL_ID',
    webhook: 'YOUR_WEBHOOK_URL',
    postmode: 'channel', // Which post mode do you want? This means how you want to post your logs, using embed or webhook. Its default value is channel.
    password: 'YOUR_TOPGG_AUTH_TOKEN',
    color: '#333333', // Optional, specify embed color
    port: '3000', // Optional, specify port number
    reminder: true, // Do you want to enable reminders? This means if you want to remind a user to vote again after 12 hours, set it to true. Otherwise, set it to false. Its default value is true.
});

client.on('ready', () => {
    console.log(`${client.user.username} is now online`);
    voteTracker.init()
});

client.login('YOUR_DISCORD_BOT_TOKEN');

Typescript

import { Client, GatewayIntentBits } from 'discord.js';
import { VoteTracker, VoteTrackerOptions } from 'vote-tracker';

// Create a Discord.js client instance
const client = new Client({
    intents: [
        GatewayIntentBits.Guilds,
        GatewayIntentBits.GuildMembers,
        GatewayIntentBits.GuildMessages,
        GatewayIntentBits.MessageContent
    ]
});

// Define options for the VoteTracker
const options: VoteTrackerOptions = {
    guildId: 'YOUR_GUILD_ID',
    roleId: 'YOUR_ROLE_ID', // Optional: specify role id
    channelId: 'YOUR_VOTE_LOG_CHANNEL_ID',
    webhook: 'YOUR_WEBHOOK_URL',
    postmode: 'channel', // Which post mode do you want? This means how you want to post your logs, using embed or webhook. Its default value is channel.
    password: 'YOUR_TOPGG_AUTH_TOKEN',
    color: '#333333', // Optional, specify embed color
    port: '3000', // Optional, specify port number
    reminder: true, // Do you want to enable reminders? This means if you want to remind a user to vote again after 12 hours, set it to true. Otherwise, set it to false. Its default value is true.
};

// Create an instance of VoteTracker
const voteTracker = new VoteTracker(client, options);

client.on('ready', () => {
    console.log(`${client.user?.username} is now online`);
    voteTracker.init();
});

client.login('YOUR_DISCORD_BOT_TOKEN');

Topgg Dashboard

With this example, your webhook dashboard should look like this:

top.gg Dashboard

API

VoteTracker

Constructor

  • new VoteTracker(client[, options]): Creates a new instance of VoteTracker.

    • client: Required. The Discord.js client instance.
    • options: Optional. An object containing additional configuration options.
      • guildId: The ID of your guild.
      • roleId: Optional. The ID of the role to assign to users upon voting.
      • channelId: The ID of the channel where vote logs will be sent.
      • webhook: The webhook url where vote logs will be sent.
      • postmode: Which post mode do you want? This means how you want to post your logs, using embed or webhook.
      • password: Your top.gg authentication token.
      • color: Optional. The color of the embeds. Defaults to '#333333'.
      • port: Optional. The port number. Defaults to '3000'.
      • reminder: Do you want to enable reminders? This means if you want to remind a user to vote again after 12 hours, set it to true. Otherwise, set it to false. Its default value is true.

Example

Common Js

const VoteTracker = require('vote-tracker');

// Initialize VoteTracker with client instance and options
const voteTracker = new VoteTracker(client, {
    guildId: 'YOUR_GUILD_ID',
    roleId: 'YOUR_ROLE_ID', // Optional: specify role id
    channelId: 'YOUR_VOTE_LOG_CHANNEL_ID',
    webhook: 'YOUR_WEBHOOK_URL',
    postmode: 'channel', // Which post mode do you want? This means how you want to post your logs, using embed or webhook. Its default value is channel.
    password: 'YOUR_TOPGG_AUTH_TOKEN',
    color: '#333333', // Optional, specify embed color
    port: '3000', // Optional, specify port number
    reminder: true, // Do you want to enable reminders? This means if you want to remind a user to vote again after 12 hours, set it to true. Otherwise, set it to false. Its default value is true.

});


// start the VoteTracker instance
voteTracker.init()

Typescript

import { VoteTracker, VoteTrackerOptions } from 'vote-tracker';

const options: VoteTrackerOptions = {
    guildId: 'YOUR_GUILD_ID',
    roleId: 'YOUR_ROLE_ID', // Optional: specify role id
    channelId: 'YOUR_VOTE_LOG_CHANNEL_ID',
    webhook: 'YOUR_WEBHOOK_URL',
    postmode: 'channel', // Which post mode do you want? This means how you want to post your logs, using embed or webhook. Its default value is channel.
    password: 'YOUR_TOPGG_AUTH_TOKEN',
    color: '#333333', // Optional, specify embed color
    port: '3000', // Optional, specify port number
    reminder: true, // Do you want to enable reminders? This means if you want to remind a user to vote again after 12 hours, set it to true. Otherwise, set it to false. Its default value is true.
};

// Create an instance of VoteTracker
const voteTracker = new VoteTracker(client, options);

// start the VoteTracker instance
voteTracker.init()

License

This project is licensed under the MIT License - see the LICENSE file for details.