Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

skyfold

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

skyfold

Yet another discord.js handlers to make your life easier

latest
Source
npmnpm
Version
1.1.1
Version published
Maintainers
1
Created
Source

SkyFold Asset

SkyFold

SkyFold, where discord.js handlers are on another level. The best TypeScript discord.js handlers that are also super light to install.


Contents

  • Installation
  • Using Commands
  • Using Events
  • Advanced
  • Credits
  • Star History

Installation

Installing the stable version from npm.

npm i skyfold@latest discord.js

Or you can use the latest and also the dev version through npm

npm i github:aggelos-007/skyfold discord.js

After you installed the package you are ready to start you journey building your discord bot! You can initiate the client like discord.js has!

import { Client, } from "skyfold";

const client = new Client({
    ...ClientOptions,
});

client.login("TOKEN");

Using Commands

First of all, we need to load all the commands so in your main file you will have to tell SkyFold where to load commands from like this:

import { Client, } from "skyfold";

const client = new Client({
    ...ClientOptions,
    prefixes?: string[] //Optional, required only when you want to use prefix commands
});

client.commandLoader("./commands");

client.login("TOKEN");

Now that all your commands under commands folder will be loaded, it's time to understand how to create them!
First of all, starting with the structure, this is the accepted structure:

import { createCommand } from "skyfold";

export const data = createCommand | createCommand[]

Now gong on based the commands, here is how the createCommand function should be structured as:

Prefixed Commands

Here is how the createCommand should look for prefixed commands

createCommand({
    data: new PrefixedCommandBuilder()
    .setName(string) // Optional only when alwaysReply is set to true
    .setAliases(...string) // Optional
    .setDescription(string) // Optional
    .setParams(...ParamBuilder) // Optional, used only for when you want params
    .setAlwaysReply(boolean)
    .validateCmd( 
        (client: Client, msg: Message) => Promise<boolean> | boolean
    ), // Optional, used only when you want to run some code before running the code and if you want to prevent it from working by returning a boolean
    code: (ctx: {
        client: Client;
        msg: Message;
        args: Params[]; // This is based on the params you have put, it returns the right type
    }) => Promise<void> | void;
})

Here is how ParamBuilder class is structured and all the available param types:

new ParamBuilder()
.setName(string) // Optional
.setDescription(string) // Optional
.setRest(boolean) // Required. True = returns an array of the type by getting all the args users provided | False = return the type only
.setRequired(boolean) // Optional
.setType(ParamType) // Required. Need to use ParamType[keyof ParamType]
// Optional. This method is used to handle errors whenever users fail to return a valid type or don't provide a required param
.setErrorHandler( 
    (client: Client, msg: Message, errorType: "missing" | "wrongType") => Promise<void> | void
)

//ParamType Enum
enum ParamType {
    String
    Number
    User
    Member
    Channel
    Role
};

Slash Commands

Here is how the createCommand should look for slash commands

createCommand({
    data: new SlashCommandBuilder() // This is the same with the discord.js builder but with 1 extra method
    .onlyForGuilds(...string) // Optional, makes the slash command guild only and not as global
    code: (ctx: { 
        client: Client;
        int: ChatInputCommandInteraction
    }) => Promise<void> | void;
})

Interaction Commands

Here is how the createCommand should look for interaction commands

createCommand({
    data: new InteractionCommandBuilder()
    .setName(name) // Optional
    .setType(InteractionType) //Optional, default: InteractionType.All. Need to use InteractionType[keyof InteractionType]
    code: (ctx: {
        client: Client;
        int: Interaction; // This interaction type changes to the type you provide in the builder
    }) => Promise<void> | void;
})
// InteractionType enum
enum InteractionType {
    All
    Modal
    Button
    AutoComplete
    RoleSelectMenu
    UserSelectMenu
    StringSelectMenu
    ChannelSelectMenu
    MentionableSelectMenu
};

Context Commands

Here is how the createCommand should look for context menu commands

createCommand({
    data: new ContextMenuCommandBuilder() // This is the same with the discord.js builder but with 1 extra method
    .onlyForGuilds(...string) // Optional, makes the context menu command guild only and not as global
    code: (ctx: {
        client: Client;
        int: ContextMenuCommandInteraction;
    }) => Promise<void> | void;
})

Using Events

First of all, we need to load all the events so in your main file you will have to tell SkyFold where to load commands from like this:

import { Client, } from "skyfold";

const client = new Client({
    ...ClientOptions
});

client.eventLoader("./events");

client.login("TOKEN");

Now that all your events under events folder will be loaded, it's time to understand how to create them!
Here is how you should be aiming to create your events:

import { createEvent } from "skyfold";

export const data = createEvents({
    name: keyof ClientEvents, // Required
    once: boolean, // Optional, default: true
    code: (client: Client, ...args: ClientEvents[EventName]) => void | Promise<void>; // Required
});

Advanced

Do you want to change the way all the interactions are handled? Here is everything you need to know about:

const client = new Client({
    ...ClientOptions,
    customHandlers: {
        prefix?: (client: Client, msg: Message) => Promise<void> | void;
        slash?: (client: Client, int: ChatInputCommandInteraction) => Promise<void> | void;
        interactions?: (client: Client, int: Interaction) => Promise<void> | void;
    };
})

Credits

This package was made with love by this guy <3


Agglos-007

Star History

Star History Chart

Keywords

d.js

FAQs

Package last updated on 28 Aug 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts