1.2.7 • Published 2 years ago

slzpackage v1.2.7

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

Intro

slzpackage is a package for discord.js v13, slzpackage includes commands and events handlers, it will be updated regularly with new features.

Installation

npm i slzpackage

Index.js

In the index.js file

['name-file-for-handler'].forEach(handler => {
    require(`./name-folder-for-handlers/${handler}`)(client);
});  

Handler File

You will need the fs package

const fs = require('fs');

module.exports = async (client) => {

    //Events
    fs.readdirSync('./events')
        .filter(file => file.endsWith(".js"))
        .forEach(file => {
            const event = require(`../events/${file}`)
            client.on(event.event, event.run)
        })
    //Commands
    const subFolders = fs.readdirSync('./commands')
    for (const category of subFolders) {
        const commandsFiles = fs.readdirSync(`./commands/${category}`).filter(file => file.endsWith('.js'))
        for (const commandFile of commandsFiles) {
            const command = require(`../commands/${category}/${commandFile}`)
            client.commands.set(command.name, command)
            if (command.aliases && command.aliases.length > 0) {
                command.aliases.forEach(alias => client.aliases.set(alias, command))
            }
        }
    }
}

Test Event

    const { Event } = require("slzpackage")

    module.exports = new Event("messageCreate", (message) => {
        if (message.content === 'ping') {
            message.reply('pong');
        }
    })

Test Command

const { Command } = require("slzpackage");

module.exports = new Command({
    name: 'ping',
    dirname: __dirname,
    run: async ({client, message, args}) => {
        message.reply("pong!")
    },
});
1.2.7

2 years ago

1.2.6

2 years ago

1.2.5

2 years ago

1.2.4

2 years ago

1.2.3

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.2.0

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago