Skip to content

Setup Seyfert Project

Typescript settings

To make Seyfert work as intended you must update your tsconfig.json file and add emitDecoratorMetadata and experimentalDecorators to be able to use decorators:

tsconfig.json
1
{
2
"compilerOptions": {
3
4
"emitDecoratorMetadata": true,
5
"experimentalDecorators": true,
6
}
7
}

Selecting Your Bot Type.

Currently, Seyfert supports two types of applications: one based on the Discord gateway, which is the most commonly used, and another based on the Discord HTTP interaction system, which is less frequently used. It is important to understand the differences between these two types in order to choose the appropriate application for your needs.

  • Gateway client receive all events from discord like messageCreate, interactionCreate, guildCreate, ready…
  • The events that the client receive depends of the client intents.

Configuration

Once tsconfig.json has been modified, we still have a few steps to go before we can run the application. In this case you need to tell seyfert your project’s structure: so is necessary to create a file called seyfert.config.js in the root folder of your project and add the following code:

seyfert.config.js
1
// @ts-check is better
2
const { config } = require('seyfert');
3
4
module.exports = config.bot({
5
token: process.env.BOT_TOKEN ?? "",
6
intents: ["Guilds"],
7
locations: {
8
base: "src",
9
output: "dist", //If you are using bun, set "src" instead
10
commands: "commands"
11
}
12
});

And let’s create the main file called index in the src folder and add the following code:

src/index.ts
1
import { Client } from 'seyfert';
2
3
const client = new Client();
4
5
// This will start the connection with the gateway and load commands, events, components and langs
6
client.start();

So after complete these steps, your project structure should look like this:

  • Directorysrc
    • Directorycommands/
    • index.ts
  • seyfert.config.js
  • package.json
  • .env
  • tsconfig.json