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-miscellaneous

v1.0.8

Published

Multiple useful functions for your Discord bot.

Downloads

11

Readme

discord-miscellaneous

What is discord-miscellaneous?

discord-miscellaneous is an easy and easy-to-understand package, which brings class and useful functions for your Discord Bot.

Installation

npm install discord-miscellaneous --save

Information

  • Economy System (Per Guild & Global).
  • Level System.
  • Level Up Card.
  • Random Characters.
  • Welcome Card.

Example:

  • Economy System Per Guild:
const { Client } = require('discord.js');
const { EconomySystemPerGuild } = require('discord-miscellaneous');
const client = new Client({ intents: 32767, partials: ['MESSAGE', 'CHANNEL', 'REACTION'] });
client.economy = new EconomySystemPerGuild('Mongoose URL');
const prefix = '!';

client.on('ready', () => console.log("¡I'm ready!"));

client.on('messageCreate', async (message) => {
  if (message.author.bot) return;
  if (!message.content.startsWith(prefix)) return;
  const [command, ...args] = message.content.slice(config.length).trim().split(/ +/g);

  if (command == 'balance') {
    const balance = await client.economy.userBal(message.guildId, message.author.id);
    message.reply(`Wallet: **${balance.balMoney}**\nBank: **${balance.bankMoney}**`);
  }
});

client.login('Discord Bot Token');
  • Level System
const { Client, Collection } = require('discord.js');
const { LevelSystem } = require('discord-miscellaneous');
const client = new Client({ intents: 32767, partials: ['MESSAGE', 'CHANNEL', 'REACTION'] });
client.levels = new LevelSystem('Mongoose URL');
const prefix = '!';
const cooldownxp = new Collection();

client.on('ready', () => console.log("¡I'm ready!"));

client.on('messageCreate', async (message) => {
  if (message.author.bot) return;
  if (!cooldown.has(message.guildId + message.author.id)) {
    cooldown.set(message.guildId + message.author.id, new Collection());
  }
  let timestamps = cooldown.get(message.guildId + message.author.id);
  if (timestamps.has(message.guildId + message.author.id)) {
    if (Date.now() < timestamps.get(message.guildId + message.author.id) + 30000) return;
  }
  let randomXp = Math.floor(Math.random() * 29) + 1;
  try {
    let hasUser = await client.levels.fetchUser(message.guildId, message.author.id);
    await client.levels.addXp(message.guildId, message.author.id, randomXp);
  } catch {
    return await client.levels.createUser(message.guildId, message.author.id);
  }
  timestamps.set(message.guildId + message.author.id, Date.now() + 30000);
  setTimeout(() => timestamps.delete(message.guildId + message.author.id), 30000);
  if (!message.content.startsWith(prefix)) return;
  const [command, ...args] = message.content.slice(config.length).trim().split(/ +/g);

  if (command == 'rank') {
    const info = await client.levels.fetchUser(message.guildId, message.author.id);
    message.reply(`Level: **${info.lvl}**\nXP: **${info.xp}**`);
  }
});

client.login('Discord Bot Token');

Links