mirror of
https://github.com/sern-handler/website
synced 2026-06-23 16:22:26 +00:00
add config and tasks (almost done)
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
title: Autocomplete
|
||||
description: Implementing autocomplete in your commands
|
||||
sidebar:
|
||||
order: 7
|
||||
order: 8
|
||||
---
|
||||
|
||||
Autocomplete is a special interaction which can happen on multiple options can be suggested for a single command.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
title: Conclusion
|
||||
description: Thank you for reading the sern guide
|
||||
sidebar:
|
||||
order: 8
|
||||
order: 9
|
||||
---
|
||||
|
||||
If you reached this far, thank you for reading!
|
||||
|
||||
60
src/content/docs/v4/reference/config.mdx
Normal file
60
src/content/docs/v4/reference/config.mdx
Normal file
@@ -0,0 +1,60 @@
|
||||
---
|
||||
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'
|
||||
```
|
||||
|
||||
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/modules)
|
||||
|
||||
### tasks
|
||||
Supply a directory for sern to register [scheduled tasks](/v4/tasks)
|
||||
|
||||
### defaultPrefix
|
||||
Supply a prefix for sern to enable text commands.
|
||||
|
||||
|
||||
### user defined
|
||||
Feel free to supply any other constants / variables you may need.
|
||||
```js
|
||||
export const OWNERS = ['182326315813306368']
|
||||
```
|
||||
@@ -2,7 +2,7 @@
|
||||
title: Dependencies
|
||||
description: Customize & manage stateful dependencies
|
||||
sidebar:
|
||||
order: 5
|
||||
order: 7
|
||||
---
|
||||
|
||||
Manage objects which contain lots of state. If you were a previous user of Sapphire, dependency injection is the moral equivalent of `container`.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
title: Modules
|
||||
description: Learn how to create modules for your sern bot
|
||||
sidebar:
|
||||
order: 3
|
||||
order: 4
|
||||
---
|
||||
|
||||
|
||||
@@ -147,7 +147,7 @@ Components can carry metadata. This comes in handy when handling multiple compon
|
||||
The first `/` is significant in custom ids. On the left of it is the custom id to be matched, and on the right is any user defined data.
|
||||
:::
|
||||
|
||||
## Event Modules
|
||||
## event modules
|
||||
We are now moving to event modules, which listens to the vast streams of data provided by
|
||||
- `node-cron`, `EventType.Cron`
|
||||
- `sern`, `EventType.Sern`
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
title: Plugins
|
||||
description: Run code before execution
|
||||
sidebar:
|
||||
order: 4
|
||||
order: 5
|
||||
---
|
||||
|
||||
:::tip
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
title: Presence
|
||||
description: Manage your bot's presence programatically
|
||||
sidebar:
|
||||
order: 5
|
||||
order: 6
|
||||
---
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
title: Project Layout
|
||||
description: The layout of a sern project
|
||||
sidebar:
|
||||
order: 2
|
||||
order: 3
|
||||
---
|
||||
|
||||
A project should look like this: <br />
|
||||
@@ -14,12 +14,13 @@ import { FileTree } from '@astrojs/starlight/components';
|
||||
- commands/
|
||||
- events/
|
||||
- plugins/ # created automatically if running `sern plugins`
|
||||
- index.ts
|
||||
- index.js
|
||||
- config.js # configuration for your entire application
|
||||
- .env
|
||||
- .gitignore
|
||||
- bun.lockb
|
||||
- package.json
|
||||
- README.md
|
||||
- sern.config.json
|
||||
- tsconfig.json # jsconfig.json if you are using javascript
|
||||
- jsconfig.json # tsconfig.json if you are using typescript
|
||||
</FileTree>
|
||||
|
||||
14
src/content/docs/v4/reference/tasks.mdx
Normal file
14
src/content/docs/v4/reference/tasks.mdx
Normal file
@@ -0,0 +1,14 @@
|
||||
---
|
||||
title: Tasks
|
||||
description: Schedule and execute functions at certain times
|
||||
sidebar:
|
||||
order: 2
|
||||
---
|
||||
|
||||
Your app may need to execute tasks in the future on intervals or over a long time.
|
||||
If you haven't already, add the `tasks` directory to your [config](/v4/reference/config)
|
||||
|
||||
```js
|
||||
export const tasks = "./dist/tasks"
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user