Skip to content

Setup Project

Prerequisites

In order to use Seyfert, you must have installed:

  • NodeJS installed (18 or higher)
  • TypeScript installed (4.9 or higher)
  • npm installed (or a package manager alike)

Install seyfert

Installing seyfert...
npm add seyfert

Also you might want to install the github version for the latest changes:

Installing seyfert from github...
npm add github:tiramisulabs/seyfert

Typescript settings

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

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

Selecting Your Bot Type.

Currently, Seyfert supports two types of applications: one based on the Discord gateway, and one based on the Discord HTTP interaction system, the former being used the most. It is key to understand the differences between these two types in order to choose whichever application for your needs.

  • The Gateway client receives all events from discord like messageCreate, interactionCreate, guildCreate, ready, etc.
  • The events that the client receives depend on the client intents.

Configuration

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

seyfert.config.js
// @ts-check is better
const { config } = require('seyfert');
module.exports = config.bot({
token: process.env.BOT_TOKEN ?? "",
intents: ["Guilds"],
locations: {
base: "src",
output: "dist", //If you are using bun, set "src" instead
}
});

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

src/index.ts
import { Client, ParseClient } from "seyfert";
const client = new Client();
// This will start the connection with the gateway and load commands, events, components and langs
client.start();
declare module 'seyfert' {
interface UsingClient extends ParseClient<Client<true>> { }
}

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

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