@voiddevs.org/slashbot

1.1.8 • Public • Published

@voiddevs.org/slashbot

Do you need my help? Visit our Discord server.

NPM Downloads License

Node Version: 16.15.0

Installation

npm i "@voiddevs.org/slashbot" --save
# or
yarn add "@voiddevs.org/slashbot"

Usage

const { Intents } = require("discord.js");
const Client = require('@voiddevs.org/slashbot');

const $ = new Client({ 
    token: process.env.token,
    intents: [
        Intents.FLAGS.GUILDS
    ]
});

$.client.on('ready', () => {
    console.log('\n-[ Client Ready ]-')
    console.log(`(!): Logged as a ${$.client.user.username}#${$.client.user.discriminator}`)
    console.log(`(!): Developed with ❤️\ \ by clqu.`)
    console.log(`(!): Total ${$.commands.length} commands loaded.`)
    try {
        $.client.user.setPresence({
            activities: [
                {
                    name: `❤️ clqu`,
                    type: 'PLAYING'
                }
            ],
            status: 'ONLINE'
        });
    } catch (err) {
        console.error(err.message);
    };
});

$.init();

Command Loader

// path = required, extension = required, callback = optional
$.commandLoader('./test/commands/', '.js', (cmd) => {
    console.log(`(!): ${cmd} command loaded.`)
});

Custom Loader

const { fromDir } = require('@voiddevs.org/slashbot');

fromDir('./test/commands/', '.js', (files) => {
    files.forEach((file) => {
        const cmd = require(process.cwd()+'/'+file.split('./')[1]);
        console.log(`(!): ${cmd.name} command loaded.`)
        $.setCommand(cmd)
    })
});

Set Command

$.setCommand({
    name: "help",
    description: "Help",
    options: [],
    run: async (client, interaction) => {
        return interaction.reply('help')
    }
});

Developed with ❤️ by Void Development

Package Sidebar

Install

npm i @voiddevs.org/slashbot

Weekly Downloads

0

Version

1.1.8

License

MIT

Unpacked Size

9.89 kB

Total Files

7

Last publish

Collaborators

  • clqu
  • byqush