Skip to content

DisfoxJS/Disfox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Discord apps faster, cleaner, and smarter.


Disfox is a framework that enhances and organizes discord.js development, making building Discord applications faster, cleaner, and more structured.

Examples and documentation available in Official Documentation Site

Install

npm install disfox
yarn add disfox
pnpm add disfox
bun add disfox

Key Features

  • Result Pattern for consistent and predictable handling
  • Centralized Client and Application management
  • Simplified path and directory handling
  • Simplified file system utilities
  • Dedicated Slash Command service
  • Scalable and flexible configuration system

Compatibility

Disfox is currently not compatible with CommonJS.

Only ES Modules (ESM) are supported.

Example usage

import { SlashOptions, SlashService, SlashTag } from "disfox";

const command = new SlashService.Command("ping1")
    .description("replies")
//  .mark(SlashTag.AdminOnly) // Optional method to enable command tags, defining behavior within the Discord API.
    .action(interaction => {
        interaction.reply("Pong!");
    });

export default command;
import { Client, GatewayIntentBits, ActivityType, Events } from "discord.js";
import { Application, SlashService } from "disfox";

const client = new Client({
  intents: [GatewayIntentBits.MessageContent]
});

const app = new Application({
  token: process.env.TOKEN,
  client: client
});

await app.connect();

await app.actions.setPresence(
  ActivityType.Playing,
  "⭐ Ready! /help",
  "online"
);

app.client.on(Events.ClientReady, async () => {
  // convert Disfox model to Discord.js SlashCommand structure
  const command = await SlashService.extractFile("./commands/ping.js");

  // deploy globally
  await app.slash.deployGlobal([command]);

  // listen for interactions
  app.slash.listen({
    onError: {
      message: "Error occurred. Try again later.",
      flags: 64
    }
  });
});

Status

The framework is still under development. All suggestions and ideas are very welcome.

Community Server

Join our Discord for support, questions, and suggestions:
https://discord.gg/UuZnAuhhP6

Disfox

About

TypeScript source code for the Disfox framework, including build (dist), practical examples, and full documentation to streamline Discord.js bot development.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors