mirror of
https://github.com/sern-handler/website
synced 2026-06-15 20:32:19 +00:00
86 lines
1.8 KiB
Plaintext
86 lines
1.8 KiB
Plaintext
---
|
|
title: Config
|
|
description: Configure your bot
|
|
sidebar:
|
|
order: 2
|
|
---
|
|
Your app needs a way to store constants and required variables for the framework to work.
|
|
|
|
A project should look like this: <br />
|
|
|
|
import { FileTree } from '@astrojs/starlight/components';
|
|
|
|
<FileTree>
|
|
- src
|
|
- commands/
|
|
- events/
|
|
- plugins/
|
|
- index.js
|
|
- config.js **we are here**
|
|
- .env
|
|
- .gitignore
|
|
- bun.lockb
|
|
- package.json
|
|
- README.md
|
|
- sern.config.json
|
|
- jsconfig.json # tsconfig.json if you are using typescript
|
|
</FileTree>
|
|
|
|
## Required
|
|
|
|
### `commands`
|
|
```js title='src/config.js'
|
|
export const commands = './dist/commands'
|
|
```
|
|
:::tip
|
|
`commands` also supports an array of folders!
|
|
```js title='src/config.js'
|
|
export const commands = ['./dist/commands', './dist/components']
|
|
```
|
|
This allows you to input your buttons, select menus, and modals separate from commands!
|
|
:::
|
|
We will pass this file so sern can start properly.
|
|
|
|
```js title='src/index.js'
|
|
import * as config from './config.js'
|
|
|
|
Sern.init(config)
|
|
```
|
|
|
|
## Optional
|
|
### events
|
|
Supply a directory for sern to register [event modules](/v4/reference/modules)
|
|
```js
|
|
export const events = "./dist/events"
|
|
```
|
|
|
|
### tasks
|
|
Supply a directory for sern to register [scheduled tasks](/v4/reference/tasks)
|
|
```js
|
|
export const tasks = "./dist/tasks"
|
|
```
|
|
|
|
### defaultPrefix
|
|
Supply a prefix for sern to enable text commands.
|
|
```js
|
|
export const defaultPrefix = "?"
|
|
```
|
|
|
|
### user defined
|
|
Feel free to supply any other constants / variables you may need.
|
|
```js
|
|
export const OWNERS = ['182326315813306368']
|
|
```
|
|
|
|
|
|
:::caution
|
|
Javascript + common.js is no longer supported! The following method will not work!
|
|
We use import/export context!
|
|
```diff
|
|
-exports.default = {
|
|
- commands : "./dist/commands",
|
|
-}
|
|
+export const commands = './dist/commands';
|
|
```
|
|
:::
|