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

discord-vote

v1.0.4

Published

Paquete para crear un sistema de votaciones simple y sencillo para discord.js 14

Downloads

17

Readme

Discord-vote

npm version license

Un paquete NPM para poder tener un sistema de votaciones para Discord.js 14 de manera sencilla.

Imágenes de ejemplo

Notas: Puede que algunos ejemplos ya no se vean exactamente así debido a nuevas actualizaciones.

Modo normal

   

Modo Avanzado

   

Instalación

Para instalar el paquete, utiliza el siguiente comando:

npm install discord-vote

Ejemplo de uso en el Modo Normal

Notas: En en modo "normal", en caso de que el bot se desconecte, se perdera todo el progreso de las votaciones que no hayan terminado. En el modo "Avanzado" no se perdera ningun progreso.

const DiscordVote = require('discord-vote');
const votacion = new DiscordVote({
    client:client, //El cliente
    mode:0}); //Modo de votacion. (0 = Normal, 1 = Avanzado)
client.on('messageCreate', async (message) => {
      if (message.content.startsWith("!votacion")) {
        if (args.length >= 2) {
          const duration = args[0]; //Tiempo en minutos
          const title = args.slice(1).join(" "); // Titulo de la votacion
  
          votacion.createVote(message, title, duration);
        } else {
          message.channel.send('Uso incorrecto. Ejemplo: `!votacion 5 Titulo`');
        }
      }

client.login("TOKEN DEL BOT");

Ejemplo de uso en el modo Avanzado

const DiscordVote = require('discord-vote');
const votacion = new DiscordVote({
  client:client, //El cliente
  mode:1, //Modo de votacion. (0 = Normal, 1 = Avanzado)
  savePath: './votaciones.json', //Ruta de guardado (Avanzado)
  checkTime: 60000}); //tiempo de comprobacion (Avanzado)
//*Todo lo del modo avanzado es completamente opcional.*/
votacion.checkVotaciones(); //Utilizado para llamar a la funcion que comprueba las votaciones usando checkTime (por defeto 1 Minuto). *Necesario al usar el modo avanzado

client.on('messageCreate', async (message) => {
      if (message.content.startsWith("!votacion")) {
        if (args.length >= 2) {
          const duration = args[0]; //Tiempo en minutos
          const title = args.slice(1).join(" "); // Titulo de la votacion
  
          votacion.createVote(message, title, duration);
        } else {
          message.channel.send('Uso incorrecto. Ejemplo: `!votacion 5 Titulo`');
        }
      }

client.login("TOKEN DEL BOT");

Funciones

+ createVote(message, duration, title, savePath, debug);
+ checkVotaciones();
+ checkVotacionManual();

createVote

Inicia una votación con la duración, título y canal especificados.

  • message: Mensaje del la accion que tiene el cliente. (client.on('messageCreate',async(message) => {})En algunos casos puede ser: "msg"
  • title: Título de la votación.
  • duration: Duración de la votación en minutos.
  • savePath: Ruta de guardado personalizado. (opcional y solo para el modo Avanzado).
  • debug: true o false (opcional).

checkVotaciones

Comprueba las votaciones cada X tiempo. Definido anteriormente. (checkTime)

checkVotacionManual

Comprueba las votaciones al momento de llamar al metodo.

Licencia

Este proyecto está licenciado bajo la Licencia GPL-3.0. Ver el archivo LICENSE para más detalles.

Autor

Contribuir

Si quieres contribuir a este proyecto, puedes seguir los siguientes pasos:

  1. Haz un fork del repositorio.
  2. Crea una rama con tu nueva funcionalidad: git checkout -b nueva-funcionalidad.
  3. Realiza tus cambios y haz commit: git commit -m "Agrega nueva funcionalidad".
  4. Haz push a la rama: git push origin nueva-funcionalidad.
  5. Abre un pull request en GitHub.