alt BlueyCommands

BlueyCommands

An advanced handler for Discord.js Bots with TypeScript and JavaScript support!

About

Bluey Commands is a command, context, and event handler made by bluey#0012. The goal of this package is to make your DiscordBot developer’s life easier.

Instalation

npm install bluey-commands
npm install discord.js@dev

required discord.js@dev version

Setup Handlers

import { Client, Intents } from 'discord.js';
import BlueyCommands from 'bluey-commands';
import { join } from 'path';

const client = new Client({
	// These intents are recommended for the built in help menu
	intents: [
		Intents.FLAGS.GUILDS,
		Intents.FLAGS.GUILD_MESSAGES,
		Intents.FLAGS.GUILD_MESSAGE_REACTIONS,
	],
});

new BlueyCommands(client, {
	// The name of the local folder for your files (absolute)
	commandsDir: join(__dirname, 'commands'),
	contextsDir: join(__dirname, 'contexts'),
	featuresDir: join(__dirname, 'features'),
	eventsDir: join(__dirname, 'events'),

	// Test only commands will be registered in these guilds
	testServers: ['guildId'],
	// Owner only commands will only be able to be used by them
	botOwners: ['userId'],
	// If true you will receive logs from loaders
	log: true,
	// Your bot's token (it is not optional)
	botToken: 'YOUR TOKEN HERE',
});

Command Structure

import { Command } from 'bluey-commands';

export default new Command({
	// Self explanatory
	name: 'ping',
	description: 'Shows my ping.',

	// Whether the command is owner only or not
	devsOnly: false,
	// If true the command will only be registeres for test servers
	testOnly: true,

	// Permissions required for this command
	permissions: ['ADMINISTRATOR'],
	// Slash Command's options
	options: [],

	/*
    	client: Your client
    	interaction: CommandInteraction
    	options: Array of command options' values
    */
	callback: async ({ client, interaction, options }) => {
		interaction.reply('Hi!');
	},
});

Context Structure

import { ContextUser } from 'bluey-commands';
// import { ContextMessage } from 'bluey-commands';

export default new ContextUser({
	// Same as command structure
	// description and options fields not required
	name: 'userinfo',

	devsOnly: false,
	testOnly: true,

	permissions: ['ADMINISTRATOR'],

	/*
    	client: Your client
    	interaction: ContextMenuInteraction
    	target: The context menu's target (Message or User)
    */
	callback: async ({ client, interaction, target }) => {
		interaction.reply('Hi!');
	},
});

// The same applies for ContextMessage

Event Structure

import { Event } from 'bluey-commands';

export default new Event(
	'message', // Key of ClientEvents - Event's name

	/*
    	client: Always the first param - Your client
    	...args: The other params that you receive from the event (message, member)

    - Full-typed
    */
	(client, message) => {}
);

Feature Structure

/*
	client: Your client
	handler: BlueyCommands class
*/
export default function (client, handler) {}

JavaScript examples soon!

Support & Feature Requests

This package is looking for feedback and ideas to help cover more use cases. If you have any ideas feel free to share them with the GitHub repository’s issues.