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

zoomhandler

v0.2.5

Published

The Best Discord Bot Events & Commands handler

Downloads

478

Readme

ZoomHandler Documentation

How To Get Support

You can join my Discord Server Support

OR

You can add me in discord: TheOldZoom

Overview

ZoomHandler is a event & slashCommand & messageCommand handler related to Discord.js v14

Installation

You can install ZoomHandler via npm:

npm install zoomhandler

or you can use npx:

npx zoomhandler

Make sure to have Zoom-Logger & Discord.js installed

Usage

To use ZoomHandler in your project, follow these steps:

  1. Import ZoomHandler: Import the ZoomHandler module into your project.

    const { ZoomHandler } = require("zoomhandler");
  2. Create an Instance: Create an instance of the ZoomHandler class, providing necessary configuration options.

    new ZoomHandler({
      client,
      messageCommandsPath: path.join(__dirname, "messageCommands"),
      interactionCommandsPath: path.join(__dirname, "interactionCommands"),
      eventsPath: path.join(__dirname, "events"),
    });
    • client: Your Zoom client instance.
    • messageCommandsPath: The path to the directory containing your message command files.
    • interactionCommandsPath: The path to the directory containing your interaction command files.
    • eventsPath: The path to the directory containing your event files.
  3. Define Message Commands: Define your commands in separate files within the specified messageCommandsPath. Each command file should export a function containing the command logic.

module.exports = {
  data: {
    name: "ping",
    description: "Ping! Pong!",
  },
  run: async ({ message, args, client }) => {
    message.channel.send("Pong!");
  },
};

Make sure to define your prefix in your main file or where your client is handled.

client.prefix = "prefix";
  1. Define Events: Define your events in separate files within the specified eventsPath. Each event file should export a function containing the discord.js event logic.

  2. Execute Commands: Execute commands using the methods provided by ZoomHandler.

Example

Here's an example demonstrating how to use ZoomHandler:

const { ZoomHandler } = require("zoomhandler");

client.prefix = ".";
new ZoomHandler({
  client,
  messageCommandsPath: path.join(__dirname, "messageCommands"),
  interactionCommandsPath: path.join(__dirname, "interactionCommands"),
  eventsPath: path.join(__dirname, "events"),
});

Here's how you should use ZoomHandler with discord.js

const { Client, GatewayIntentBits } = require("discord.js");
const { Logger } = require("zoom-logger");
const path = require("path");
const client = new Client({
  intents: [
    GatewayIntentBits.Guilds,
    GatewayIntentBits.MessageContent,
    GatewayIntentBits.GuildMessages,
  ],
});
const { ZoomHandler } = require("zoomhandler");

client.prefix = ".";
new ZoomHandler({
  client,
  messageCommandsPath: path.join(__dirname, "messageCommands"),
  interactionCommandsPath: path.join(__dirname, "interactionCommands"),
  eventsPath: path.join(__dirname, "events"),
});

client.login("Your bot token");

Example Event File

Here's an example of how to use an event file: Make sure that the event file is inside a directory that is named the same event name as you like.

// events/ready/ready.js

module.exports = (client) => {
  console.log(`${client.user.tag} is ready !`);
};
// events/messageCreate.js

module.exports = (client, message) => {
  console.log(message.content);
};

Example MessageCreate Command File

Here's an example of how to use an MessageCreate command File

// messageCommands/ping.js
// messageCommands/general/ping.js
module.exports = {
  data: {
    name: "ping",
    description: "Ping! Pong!",
  },
  run: async ({ message, args, client }) => {
    message.channel.send("Pong!");
  },
};

Example interactionCreate Command File

Here's an example of how to use an interactionCreate command File

// interactionCommands/ping.js
// interactionCommands/general/ping.js
const { SlashCommandBuilder } = require("@discordjs/builders");

module.exports = {
  data: new SlashCommandBuilder().setName("ping").setDescription("Ping Pong!"),
  run: async ({ interaction, client }) => {
    await interaction.reply("Pong!");
  },
};

Developer To-Do

  • validations (Before executing the code).
  • better documentation.