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 🙏

© 2025 – Pkg Stats / Ryan Hefner

devbotsvotes

v1.3.0

Published

A powerful and feature-rich package for monitoring votes and retrieving information for bots listed on the dev-botlist platform.

Readme

Here’s a polished README.md tailored for your NPM package with examples and usage instructions:


DevBotsVotes

DevBotsVotes is a powerful package that simplifies vote tracking for Discord bots on your bot list platform. It allows you to monitor votes, check user voting status, fetch recent votes, and more with ease.

Features

  • Track new votes in real-time.
  • Fetch all votes for your bot.
  • Check if a user has voted recently and get the time remaining.
  • Get the top voters for your bot.
  • Simple integration with Discord bots.
  • Built-in support for role assignment for voters.

Installation

Install the package using npm:

npm install devbotsvotes

Usage

Basic Setup

Here’s how to use the DevBotsVotes package to track votes for your bot:

const VoteNotifier = require('devbotsvotes');

const BOT_ID = 'YOUR_BOT_ID';
const API_TOKEN = 'YOUR_API_TOKEN';

const notifier = new VoteNotifier({ botID: BOT_ID, token: API_TOKEN });

// Start vote monitoring
notifier.start();

// Listen for new votes
notifier.on('vote', (vote) => {
    console.log('New vote detected:', vote);
});

// Stop monitoring when needed
// notifier.stop();

Check If a User Has Voted

You can check if a specific user has voted recently:

const userID = 'USER_ID_TO_CHECK';

notifier.hasUserVoted(userID).then((result) => {
    if (result.hasVoted) {
        console.log(`User ${userID} has voted! Time remaining: ${result.timeRemaining}`);
    } else {
        console.log(`User ${userID} has not voted.`);
    }
});

Fetch All Votes

Retrieve all votes for your bot:

notifier.getAllVotes().then((votes) => {
    console.log(`Total votes: ${votes.length}`);
    console.log(votes);
});

Fetch Recent Votes

Get votes received in the last specified time period (in milliseconds):

const last12Hours = 12 * 60 * 60 * 1000;

notifier.getRecentVotes(last12Hours).then((recentVotes) => {
    console.log('Recent votes:', recentVotes);
});

Fetch Top Voters

Retrieve the top voters for your bot:

notifier.getTopVotes().then((topVoters) => {
    console.log('Top voters:', topVoters);
});

Example with Discord.js

Here’s how you can integrate DevBotsVotes with a Discord bot to notify a channel when a new vote is received:

const { Client, GatewayIntentBits, EmbedBuilder } = require('discord.js');
const VoteNotifier = require('devbotsvotes');

const BOT_ID = 'YOUR_BOT_ID';
const API_TOKEN = 'YOUR_API_TOKEN';
const VOTE_CHANNEL_ID = 'YOUR_CHANNEL_ID';

const client = new Client({
    intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages],
});

const notifier = new VoteNotifier({ botID: BOT_ID, token: API_TOKEN });

client.once('ready', () => {
    console.log(`Logged in as ${client.user.tag}!`);

    notifier.start();

    notifier.on('vote', async (vote) => {
        const voteChannel = client.channels.cache.get(VOTE_CHANNEL_ID);
        if (voteChannel) {
            const embed = new EmbedBuilder()
                .setTitle('🎉 New Vote Received!')
                .setColor(0x00ff00)
                .setDescription(
                    `👤 **User:** <@${vote.userID}>\n` +
                    `📅 **Date:** ${new Date(vote.voteDate).toLocaleString()}\n` +
                    `🤖 **Bot ID:** \`${vote.botID}\``
                )
                .setFooter({ text: 'Thank you for voting!' })
                .setTimestamp();

            await voteChannel.send({ embeds: [embed] });
        } else {
            console.error('Vote channel not found.');
        }
    });
});

client.login('YOUR_DISCORD_BOT_TOKEN');

API Reference

new VoteNotifier(options)

  • options.botID (required): The bot's ID.
  • options.token (required): API token for authentication.
  • options.pollingInterval (optional): Interval for checking new votes (default: 30000 ms).
  • options.autoRetry (optional): Automatically retry on API errors (default: true).

Methods

start()

Starts monitoring votes.

stop()

Stops monitoring votes.

hasUserVoted(userID)

Checks if a user has voted recently.

  • Returns: A promise that resolves to an object:
    {
        "hasVoted": true,
        "timeRemaining": "11h 58m 32s",
        "voteDate": "2025-01-21T07:41:13.274Z"
    }

getAllVotes()

Fetches all votes for the bot.

getRecentVotes(timeRange)

Fetches votes within a specific time range (in milliseconds).

getTopVotes()

Fetches the top voters for the bot.


License

This project is licensed under the SimPL-2.0 License.


Feel free to reach out or open an issue for questions or improvements! 🚀