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

creatordjs

v1.3.1

Published

A Node.js package for creating Discord bots using Discord.js v14

Downloads

184

Readme

CreatorDJS

CreatorDJS is a Node.js package that simplifies the process of creating Discord bots using Discord.js v14. It provides easy-to-use methods for setting up and managing bot functionality, including slash commands, prefix commands, and database connections.

Installation

You can install CreatorDJS via npm:

npm install creatordjs

Usage

Here's how you can use CreatorDJS to create a Discord bot:

const creatordjs = require('creatordjs');
require('dotenv').config();
 
// Initialize token and set prefix
const token = process.env.BOT_TOKEN;
const prefix = '!';
const client = creatordjs.init(token, prefix);
 
// Create slash commands
const slashCommands = [
//   Define slash commands here
];
creatordjs.slash(slashCommands);

// Create prefix commands
const prefixCommands = [
//   Define prefix commands here
];
creatordjs.message(prefixCommands);

// Connect to MongoDB database
const mongooseUrl = process.env.MONGOOSE_URL;
creatordjs.database(mongooseUrl);

// Set custom bot activity
creatordjs.setActivity('online', 'Meow', 1, 'https://youtube.com/@meowdev7');

Command Template

Slash Commands - default

{
    name: 'ping',
    description: 'Ping command',
    cooldown: 3,
    dev: false,
    options: [],
    botPermissions: ["SendMessages"],
    userPermissions: ["SendMessages"],
    async execute(interaction) {

    }
}

Slash Commands - builder

{
    data: new SlashCommandBuilder()
        .setName('ping')
        .setDescription('Ping the bot.'),
    cooldown: 3,
    dev: false,
    botPermissions: ["SendMessages"],
    userPermissions: ["SendMessages"],
    async execute(interaction) {

    }
} 

Message Commands

{
    name: 'ping',
    description: 'Ping command',
    cooldown: 3,
    dev: false,
    botPermissions: ["SendMessages"],
    userPermissions: ["SendMessages"],
    async execute(message, args) {

    }
}

Features

  • Initializing the Bot: Use creatordjs.init(token, prefix) to initialize your bot with your Discord bot token and command prefix.
  • Registering Slash Commands: Use creatordjs.slash(commands) to register slash commands for your bot.
  • Registering Prefix Commands: Use creatordjs.message(commands) to register prefix commands for your bot.
  • Connecting to Database: Use creatordjs.database(mongooseUrl) to connect your bot to a MongoDB database using Mongoose.
  • Developer Restriction: Restrict certain commands to bot developers for added security. Use creatordjs.setDevs(["id1", "id2"]) to specify bot developer IDs.
  • Permission Checks: Check user and bot permissions before executing commands.
  • Cooldown Management: Manage command cooldowns to prevent spamming.
  • Dynamic Command Loading: Load commands dynamically from a specified directory. Use creatordjs.load(directory).
  • Event Handling: Handle Discord events seamlessly with event listeners. Use creatordjs.event(events).
  • Slash Command Type: Choose between two types of slash command registration: "default" or "builder". Use creatordjs.setSlash(type) to specify the type.
  • Error Handling: Integrated error handling with an errorHandler function.

Prebuilt Commands

Slash Commands

Here are some prebuilt slash commands available for use:

  • ping: Ping command to check bot latency.
  • Add more slash commands as needed.

Message (Prefix) Commands

Here are some prebuilt message commands available for use:

  • ping: Ping command to check bot latency.
  • Add more message commands as needed.

Tutorial

Check out the tutorial playlist. YouTube Playlist

Support

For additional help and support, join our Discord server: Meow Dev 7's Lab Discord Server

Suggestions

We welcome your suggestions and feedback! Feel free to post them on our Discord server.

License

This project is licensed under the ISC License.

Modules Used

  • chalk - For colored console output
  • discord.js - Discord API library for Node.js
  • dotenv - For loading environment variables
  • mongoose - MongoDB object modeling tool designed to work in an asynchronous environment
  • table - For generating ASCII tables