Getting Started

Configuring Seyfert

TypeScript Configuration

For Seyfert to work correctly, you need to update your tsconfig.json file and add emitDecoratorMetadata and experimentalDecorators to enable the use of decorators:

tsconfig.json
{
    "compilerOptions": {
        "emitDecoratorMetadata": true,
        "experimentalDecorators": true,
    }
}

Selecting the Bot Type

Seyfert supports two types of applications that interact with the Discord API: one based on the gateway (websocket) and another based on the HTTP interaction system.

Each type has a distinct purpose, and it is crucial to understand their differences to choose the one that best suits your needs. If you are unsure which bot type to choose, we recommend using the Gateway option.

  • The Gateway client handles all events emitted by Discord, such as messageCreate, interactionCreate, guildCreate, ready, among others.
  • The available events depend on the intents configured in the client.

Configuration

Once you have modified the tsconfig.json to support decorators, there are a few more steps before you can run your application. Seyfert is set up to automatically load your commands, events, components, and language.

For this, you need to create a file called seyfert.config.mjs in the root folder of your project and add the configuration according to the bot type you selected:

seyfert.config.mjs
import {  } from "seyfert";
 
export default .({
    : .. ?? "",
    : {
        : "dist", // replace with "src" if using bun
        : "commands"
    },
    : ["Guilds"],
    // This configuration is optional, in case you want to receive interactions via HTTP
    // This allows you to use both the gateway and the HTTP webhook
    : "...", // replace with your public key
    : 4444, // replace with your application's port 
});

This is not all, you also need to create a main file called index.ts inside the src folder (specified as base in the configuration) and start using it.

src/index.ts
import {  } from "seyfert";
 
const  = new ();
 
// This will start the connection with the Discord gateway and load commands, events, components, and language (i18n)
.();

In addition to the above, you need to configure the appropriate types based on the client you are using:

import type { , , ,  } from 'seyfert';
 
declare module 'seyfert' {
 
    interface UsingClient extends <<true>> { }
  
  
    interface UsingClient extends <> { }
  
  
    interface UsingClient extends <<true>> { }
}

For more information on how to declare types and what you can do with them, visit extending declare module.

Once these steps are completed, your project structure should look like this:

src
commands
index.ts
package.json
seyfert.config.mjs
tsconfig.json
.env

On this page