Installation
If you haven't already, start by creating a new project. Next, we will need to install the module. For everything to work correctly, you will need a few prerequisites:
Prerequisites | Version | Required |
---|---|---|
Node.js | 18 | ✅ |
discord.js | 14.15.2 | ✅ |
typescript | 5.4.2 | ❌ |
bash
npm i umbrae
Now let's create a file index.js
(or .ts
depending on your preference) at the root of our project, and we will import some functionalities for the bot. You have 2 ways to manage your app:
js
import { App, AppIntents, AppManager } from 'umbrae';
const app = new App({ intents: [AppIntents.All]});
new AppManager(
app,
{
commandPath: './commands/',
eventPath: './events/',
token: 'YOUR_TOKEN_HERE',
clientId: 'YOUR_CLIENT_ID_HERE',
guildId: 'YOUR_GUILD_ID_HERE',
prefix: 'YOUR_PREFIX_HERE'
}
);
ts
import { App, AppIntents, AppManager, ManagerOptions } from "umbrae";
const app: App = new App(
{
intents: [
AppIntents.All
]
}
);
const manager: ManagerOptions = {
commandPath: './src/commands/',
eventPath: './src/events/',
token: 'YOUR_TOKEN_HERE',
clientId: 'YOUR_CLIENT_ID_HERE',
guildId: 'YOUR_GUILD_ID_HERE',
prefix: 'YOUR_PREFIX_HERE'
}
new AppManager(
app,
manager
);
or
txt
TOKEN=YOUR_TOKEN_HERE
CLIENT_ID=YOUR_CLIENT_ID_HERE
GUILD_ID=YOUR_GUILD_ID_HERE
js
import { App, AppIntents, AppManager } from 'umbrae';
import dotenv from 'dotenv';
dotenv.config();
const app = new App({ intents: [AppIntents.All]});
new AppManager(
app,
{
commandPath: './commands/',
eventPath: './events/',
prefix: 'YOUR_PREFIX_HERE'
}
);
ts
import { App, AppIntents, AppManager, ManagerOptions } from "umbrae";
import dotenv from 'dotenv';
dotenv.config();
const app: App = new App(
{
intents: [
AppIntents.All
]
}
);
const manager: ManagerOptions = {
commandPath: './commands/',
eventPath: './events/',
prefix: 'YOUR_PREFIX_HERE'
}
new AppManager(
app,
manager
);
Warning
Both guildId
and prefix
are optional for this manager. If you don't specify your own prefix, !
will be used to manage message commands if you build message commands. And if you don't specify guildId
, your commands will be deployed in global instead of local
Looking for creating commands faster ?
We recommend to use the following command in your terminal to create a template command.
bash
npm run umbrae:cmd