Skip to content

About

ForgeScript is the fast, function-based scripting framework to create Discord bots in an effortless and modular way.

Resources

Contributing

Stars

51 stars

Watchers

1 watching

Forks

Repository files navigation

ForgeScript logo

ForgeScript

A fast, lightweight, and extensible scripting framework for building Discord bots in Node.js.

NPM version NPM downloads License Discord

Documentation          Function Reference          Discord Community


Overview

ForgeScript is a lightweight scripting language built on top of discord.js that makes Discord bot development fast and straightforward. Instead of dealing with massive boilerplate, you write clean code that executes top to bottom.

  • 1,100+ Functions: Built-in support for embeds, components, automod, moderation, math, and string tools.
  • Prefix & Slash Commands: Dedicated file loaders for standard message commands and Discord Application (slash) commands.
  • Extensible: Easily add custom functions or plug in database and canvas extensions.
  • TypeScript Ready: Types included out of the box.

Installation

Ensure you have Node.js v22.0.0 or higher installed.

npm install @tryforge/forgescript

Getting Started

1. Initialize the Client (index.js)

Tip: You can use the BotForge Client Generator to configure intents, events, and generate this file interactively.

const { ForgeClient } = require("@tryforge/forgescript");

const client = new ForgeClient({
  prefixes: ["!"],
  intents: [
    "Guilds",
    "GuildMessages",
    "MessageContent", // Privileged intent: enable in Discord Developer Portal
  ],
  events: [
    "messageCreate",
    "interactionCreate", // Required for slash commands and components
    "clientReady",
  ],
});

// Load standard prefix commands
client.commands.load("./commands/prefix");

// Load slash / application commands
client.applicationCommands.load("./commands/slash");

// The use of env variables is encouraged, skipped for simplicity.
client.login("YOUR BOT'S TOKEN HERE"); // NEVER share your bot token!

2. Prefix Command Example (commands/prefix/ping.js)

In ForgeScript, code runs sequentially from top to bottom. Built-in functions like $title, $description, and $addField make creating rich embeds effortless without constructing complex objects:

module.exports = {
  name: "ping",
  type: "messageCreate",
  code: `
    $title[Pong! 🏓]
    $description[Current bot performance and connection status:]
    $addField[Latency;$pingms;true]
    $addField[Uptime;$parseMS[$uptime];true]
    $color[#5865F2]
    $footer[Requested by $username;$userAvatar]
  `,
};

Command Output Preview

3. Slash Command Example (commands/slash/ping.js)

Slash commands define a Discord data object alongside their executable code:

module.exports = {
  data: {
    name: "ping",
    description: "Check bot latency",
  },
  code: `Pong! Latency: $pingms`,
};

Tip: You can visually configure options, choices, and subcommands using the Application Command Builder to generate your data structure. For further details, check out the Slash Commands Guide.


Extensions

ForgeScript can be augmented with extensions. For example, to add database capabilities with ForgeDB:

npm install @tryforge/forge.db
const { ForgeClient } = require("@tryforge/forgescript");
const { ForgeDB } = require("@tryforge/forge.db");

const client = new ForgeClient({
  prefixes: ["!"],
  intents: ["Guilds", "GuildMessages", "MessageContent"],
  events: ["messageCreate"],
  extensions: [
    new ForgeDB(),
  ],
});

Contributors

Thank you to everyone contributing to ForgeScript!

ForgeScript Contributors


Resources & Community


License

This project is licensed under the LGPL-3.0-or-later License.

About

ForgeScript is the fast, function-based scripting framework to create Discord bots in an effortless and modular way.

Resources

Contributing

Stars

51 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages