mirror of
https://github.com/sern-handler/website
synced 2026-06-06 01:16:47 +00:00
feat adding guide to repo, adding api
This commit is contained in:
1
docs/api/_category_.yml
Normal file
1
docs/api/_category_.yml
Normal file
@@ -0,0 +1 @@
|
||||
label: "API"
|
||||
243
docs/api/classes/Context.md
Normal file
243
docs/api/classes/Context.md
Normal file
@@ -0,0 +1,243 @@
|
||||
---
|
||||
id: "Context"
|
||||
title: "Class: Context"
|
||||
sidebar_label: "Context"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
Provides values shared between
|
||||
Message and ChatInputCommandInteraction
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
• `Private` **new Context**(`oMsg?`, `oInterac?`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Default value |
|
||||
| :------ | :------ | :------ |
|
||||
| `oMsg` | `Option`<`Message`<`boolean`\>\> | `None` |
|
||||
| `oInterac` | `Option`<`ChatInputCommandInteraction`<`CacheType`\>\> | `None` |
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/handler/structures/context.ts:31](https://github.com/sern-handler/handler/blob/2009593/src/handler/structures/context.ts#L31)
|
||||
|
||||
## Accessors
|
||||
|
||||
### channel
|
||||
|
||||
• `get` **channel**(): [`Nullish`](../modules.md#nullish)<`TextBasedChannel`\>
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Nullish`](../modules.md#nullish)<`TextBasedChannel`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/handler/structures/context.ts:63](https://github.com/sern-handler/handler/blob/2009593/src/handler/structures/context.ts#L63)
|
||||
|
||||
___
|
||||
|
||||
### client
|
||||
|
||||
• `get` **client**(): `Client`<`boolean`\>
|
||||
|
||||
#### Returns
|
||||
|
||||
`Client`<`boolean`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/handler/structures/context.ts:108](https://github.com/sern-handler/handler/blob/2009593/src/handler/structures/context.ts#L108)
|
||||
|
||||
___
|
||||
|
||||
### createdTimestamp
|
||||
|
||||
• `get` **createdTimestamp**(): `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/handler/structures/context.ts:77](https://github.com/sern-handler/handler/blob/2009593/src/handler/structures/context.ts#L77)
|
||||
|
||||
___
|
||||
|
||||
### guild
|
||||
|
||||
• `get` **guild**(): `Guild`
|
||||
|
||||
#### Returns
|
||||
|
||||
`Guild`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/handler/structures/context.ts:84](https://github.com/sern-handler/handler/blob/2009593/src/handler/structures/context.ts#L84)
|
||||
|
||||
___
|
||||
|
||||
### guildId
|
||||
|
||||
• `get` **guildId**(): `string`
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/handler/structures/context.ts:91](https://github.com/sern-handler/handler/blob/2009593/src/handler/structures/context.ts#L91)
|
||||
|
||||
___
|
||||
|
||||
### id
|
||||
|
||||
• `get` **id**(): `string`
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/handler/structures/context.ts:56](https://github.com/sern-handler/handler/blob/2009593/src/handler/structures/context.ts#L56)
|
||||
|
||||
___
|
||||
|
||||
### inGuild
|
||||
|
||||
• `get` **inGuild**(): `boolean`
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/handler/structures/context.ts:115](https://github.com/sern-handler/handler/blob/2009593/src/handler/structures/context.ts#L115)
|
||||
|
||||
___
|
||||
|
||||
### interaction
|
||||
|
||||
• `get` **interaction**(): `ChatInputCommandInteraction`<`CacheType`\>
|
||||
|
||||
Getting the ChatInputCommandInteraction object. Crashes if module type is
|
||||
CommandType.Text or the event fired in a Both command was
|
||||
Message
|
||||
|
||||
#### Returns
|
||||
|
||||
`ChatInputCommandInteraction`<`CacheType`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/handler/structures/context.ts:52](https://github.com/sern-handler/handler/blob/2009593/src/handler/structures/context.ts#L52)
|
||||
|
||||
___
|
||||
|
||||
### member
|
||||
|
||||
• `get` **member**(): [`Nullish`](../modules.md#nullish)<`GuildMember` \| `APIGuildMember`\>
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Nullish`](../modules.md#nullish)<`GuildMember` \| `APIGuildMember`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/handler/structures/context.ts:101](https://github.com/sern-handler/handler/blob/2009593/src/handler/structures/context.ts#L101)
|
||||
|
||||
___
|
||||
|
||||
### message
|
||||
|
||||
• `get` **message**(): `Message`<`boolean`\>
|
||||
|
||||
Getting the Message object. Crashes if module type is
|
||||
CommandType.Slash or the event fired in a Both command was
|
||||
ChatInputCommandInteraction
|
||||
|
||||
#### Returns
|
||||
|
||||
`Message`<`boolean`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/handler/structures/context.ts:44](https://github.com/sern-handler/handler/blob/2009593/src/handler/structures/context.ts#L44)
|
||||
|
||||
___
|
||||
|
||||
### user
|
||||
|
||||
• `get` **user**(): `User`
|
||||
|
||||
#### Returns
|
||||
|
||||
`User`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/handler/structures/context.ts:70](https://github.com/sern-handler/handler/blob/2009593/src/handler/structures/context.ts#L70)
|
||||
|
||||
## Methods
|
||||
|
||||
### isEmpty
|
||||
|
||||
▸ **isEmpty**(): `boolean`
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/handler/structures/context.ts:129](https://github.com/sern-handler/handler/blob/2009593/src/handler/structures/context.ts#L129)
|
||||
|
||||
___
|
||||
|
||||
### reply
|
||||
|
||||
▸ **reply**(`content`): `Promise`<`Message`<`boolean`\>\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `content` | `string` \| `Omit`<`InteractionReplyOptions`, ``"fetchReply"``\> \| `ReplyMessageOptions` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Message`<`boolean`\>\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/handler/structures/context.ts:133](https://github.com/sern-handler/handler/blob/2009593/src/handler/structures/context.ts#L133)
|
||||
|
||||
___
|
||||
|
||||
### wrap
|
||||
|
||||
▸ `Static` **wrap**(`wrappable`): [`Context`](Context.md)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `wrappable` | `Message`<`boolean`\> \| `ChatInputCommandInteraction`<`CacheType`\> |
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Context`](Context.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/handler/structures/context.ts:122](https://github.com/sern-handler/handler/blob/2009593/src/handler/structures/context.ts#L122)
|
||||
1116
docs/api/classes/SernEmitter.md
Normal file
1116
docs/api/classes/SernEmitter.md
Normal file
File diff suppressed because it is too large
Load Diff
2
docs/api/classes/_category_.yml
Normal file
2
docs/api/classes/_category_.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
label: "Classes"
|
||||
position: 3
|
||||
116
docs/api/enums/CommandType.md
Normal file
116
docs/api/enums/CommandType.md
Normal file
@@ -0,0 +1,116 @@
|
||||
---
|
||||
id: "CommandType"
|
||||
title: "Enumeration: CommandType"
|
||||
sidebar_label: "CommandType"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
**`Example`**
|
||||
|
||||
```ts
|
||||
export default commandModule({
|
||||
// highlight-next-line
|
||||
type : CommandType.Text,
|
||||
name : 'a text command'
|
||||
execute(message) {
|
||||
console.log(message.content)
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
## Enumeration Members
|
||||
|
||||
### Both
|
||||
|
||||
• **Both** = ``3``
|
||||
|
||||
The CommandType for hybrid commands, text and slash
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/handler/structures/enums.ts:27](https://github.com/sern-handler/handler/blob/2009593/src/handler/structures/enums.ts#L27)
|
||||
|
||||
___
|
||||
|
||||
### Button
|
||||
|
||||
• **Button** = ``16``
|
||||
|
||||
The CommandType for ButtonInteraction commands
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/handler/structures/enums.ts:39](https://github.com/sern-handler/handler/blob/2009593/src/handler/structures/enums.ts#L39)
|
||||
|
||||
___
|
||||
|
||||
### MenuMsg
|
||||
|
||||
• **MenuMsg** = ``8``
|
||||
|
||||
The CommandType for MessageContextMenuInteraction commands
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/handler/structures/enums.ts:35](https://github.com/sern-handler/handler/blob/2009593/src/handler/structures/enums.ts#L35)
|
||||
|
||||
___
|
||||
|
||||
### MenuSelect
|
||||
|
||||
• **MenuSelect** = ``32``
|
||||
|
||||
The CommandType for SelectMenuInteraction commands
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/handler/structures/enums.ts:43](https://github.com/sern-handler/handler/blob/2009593/src/handler/structures/enums.ts#L43)
|
||||
|
||||
___
|
||||
|
||||
### MenuUser
|
||||
|
||||
• **MenuUser** = ``4``
|
||||
|
||||
The CommandType for UserContextMenuInteraction commands
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/handler/structures/enums.ts:31](https://github.com/sern-handler/handler/blob/2009593/src/handler/structures/enums.ts#L31)
|
||||
|
||||
___
|
||||
|
||||
### Modal
|
||||
|
||||
• **Modal** = ``64``
|
||||
|
||||
The CommandType for ModalSubmitInteraction commands
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/handler/structures/enums.ts:47](https://github.com/sern-handler/handler/blob/2009593/src/handler/structures/enums.ts#L47)
|
||||
|
||||
___
|
||||
|
||||
### Slash
|
||||
|
||||
• **Slash** = ``2``
|
||||
|
||||
The CommandType for slash commands
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/handler/structures/enums.ts:23](https://github.com/sern-handler/handler/blob/2009593/src/handler/structures/enums.ts#L23)
|
||||
|
||||
___
|
||||
|
||||
### Text
|
||||
|
||||
• **Text** = ``1``
|
||||
|
||||
The CommandType for text commands
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/handler/structures/enums.ts:19](https://github.com/sern-handler/handler/blob/2009593/src/handler/structures/enums.ts#L19)
|
||||
57
docs/api/enums/EventType.md
Normal file
57
docs/api/enums/EventType.md
Normal file
@@ -0,0 +1,57 @@
|
||||
---
|
||||
id: "EventType"
|
||||
title: "Enumeration: EventType"
|
||||
sidebar_label: "EventType"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
**`Example`**
|
||||
|
||||
```ts
|
||||
export default eventModule({
|
||||
//highlight-next-line
|
||||
type : EventType.Discord,
|
||||
name : 'guildMemberAdd'
|
||||
execute(member : GuildMember) {
|
||||
console.log(member)
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
## Enumeration Members
|
||||
|
||||
### Discord
|
||||
|
||||
• **Discord** = ``1``
|
||||
|
||||
The EventType for handling discord events
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/handler/structures/enums.ts:68](https://github.com/sern-handler/handler/blob/2009593/src/handler/structures/enums.ts#L68)
|
||||
|
||||
___
|
||||
|
||||
### External
|
||||
|
||||
• **External** = ``3``
|
||||
|
||||
The EventType for handling external events.
|
||||
Could be for example, `process` events, database events
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/handler/structures/enums.ts:77](https://github.com/sern-handler/handler/blob/2009593/src/handler/structures/enums.ts#L77)
|
||||
|
||||
___
|
||||
|
||||
### Sern
|
||||
|
||||
• **Sern** = ``2``
|
||||
|
||||
The EventType for handling sern events
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/handler/structures/enums.ts:72](https://github.com/sern-handler/handler/blob/2009593/src/handler/structures/enums.ts#L72)
|
||||
43
docs/api/enums/PayloadType.md
Normal file
43
docs/api/enums/PayloadType.md
Normal file
@@ -0,0 +1,43 @@
|
||||
---
|
||||
id: "PayloadType"
|
||||
title: "Enumeration: PayloadType"
|
||||
sidebar_label: "PayloadType"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
## Enumeration Members
|
||||
|
||||
### Failure
|
||||
|
||||
• **Failure** = ``"failure"``
|
||||
|
||||
The PayloadType for a SernEmitter failure event
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/handler/structures/enums.ts:114](https://github.com/sern-handler/handler/blob/2009593/src/handler/structures/enums.ts#L114)
|
||||
|
||||
___
|
||||
|
||||
### Success
|
||||
|
||||
• **Success** = ``"success"``
|
||||
|
||||
The PayloadType for a SernEmitter success event
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/handler/structures/enums.ts:110](https://github.com/sern-handler/handler/blob/2009593/src/handler/structures/enums.ts#L110)
|
||||
|
||||
___
|
||||
|
||||
### Warning
|
||||
|
||||
• **Warning** = ``"warning"``
|
||||
|
||||
The PayloadType for a SernEmitter warning event
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/handler/structures/enums.ts:118](https://github.com/sern-handler/handler/blob/2009593/src/handler/structures/enums.ts#L118)
|
||||
43
docs/api/enums/PluginType.md
Normal file
43
docs/api/enums/PluginType.md
Normal file
@@ -0,0 +1,43 @@
|
||||
---
|
||||
id: "PluginType"
|
||||
title: "Enumeration: PluginType"
|
||||
sidebar_label: "PluginType"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
**`Example`**
|
||||
|
||||
```ts
|
||||
export default function myPlugin() : EventPlugin<CommandType.Text> {
|
||||
//highlight-next-line
|
||||
type : PluginType.Event,
|
||||
execute([ctx, args], controller) {
|
||||
return controller.next();
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Enumeration Members
|
||||
|
||||
### Command
|
||||
|
||||
• **Command** = ``1``
|
||||
|
||||
The PluginType for CommandPlugins
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/handler/structures/enums.ts:97](https://github.com/sern-handler/handler/blob/2009593/src/handler/structures/enums.ts#L97)
|
||||
|
||||
___
|
||||
|
||||
### Event
|
||||
|
||||
• **Event** = ``2``
|
||||
|
||||
The PluginType for EventPlugins
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/handler/structures/enums.ts:101](https://github.com/sern-handler/handler/blob/2009593/src/handler/structures/enums.ts#L101)
|
||||
2
docs/api/enums/_category_.yml
Normal file
2
docs/api/enums/_category_.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
label: "Enumerations"
|
||||
position: 2
|
||||
90
docs/api/index.md
Normal file
90
docs/api/index.md
Normal file
@@ -0,0 +1,90 @@
|
||||
---
|
||||
id: "index"
|
||||
title: "@sern/handler"
|
||||
sidebar_label: "Readme"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
# SernHandler
|
||||
|
||||
<a href="https://www.npmjs.com/package/@sern/handler"><img src="https://img.shields.io/npm/v/@sern/handler?maxAge=3600" alt="NPM version" /></a>
|
||||
<a href="https://www.npmjs.com/package/@sern/handler"><img src="https://img.shields.io/npm/dt/@sern/handler?maxAge=3600" alt="NPM downloads" /></a>
|
||||
[](https://opensource.org/licenses/MIT)
|
||||
|
||||
A customizable, batteries-included, powerful discord.js framework to automate and streamline your bot development.
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
npm install @sern/handler
|
||||
```
|
||||
|
||||
```sh
|
||||
yarn add @sern/handler
|
||||
```
|
||||
|
||||
```sh
|
||||
pnpm add @sern/handler
|
||||
```
|
||||
|
||||
## Basic Usage
|
||||
|
||||
#### ` index.js (CommonJS)`
|
||||
|
||||
```js
|
||||
const { Client, GatewayIntentBits } = require('discord.js');
|
||||
const { Sern } = require('@sern/handler');
|
||||
const { defaultPrefix, token } = require('./config.json');
|
||||
|
||||
const client = new Client({
|
||||
intents: [
|
||||
GatewayIntentBits.Guilds,
|
||||
GatewayIntentBits.GuildMembers,
|
||||
GatewayIntentBits.GuildMessages
|
||||
]
|
||||
});
|
||||
|
||||
Sern.init({
|
||||
client,
|
||||
defaultPrefix,
|
||||
commands : 'src/commands',
|
||||
});
|
||||
|
||||
client.login(token);
|
||||
```
|
||||
|
||||
#### ` ping.js (CommonJS)`
|
||||
|
||||
```js
|
||||
const { Sern, CommandType } = require('@sern/handler');
|
||||
|
||||
exports.default = {
|
||||
description: 'A ping pong command',
|
||||
type: CommandType.Slash,
|
||||
execute(ctx) {
|
||||
ctx.reply('pong!');
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
See our [templates](https://github.com/sern-handler/templates) for TypeScript examples and more
|
||||
|
||||
## CLI
|
||||
|
||||
It is **highly encouraged** to use the [command line interface](https://github.com/sern-handler/cli) for your project. Don't forget to view it.
|
||||
|
||||
## Links
|
||||
|
||||
- [Official Documentation](https://sern-handler.js.org)
|
||||
- [Support Server](https://discord.com/invite/mmyCTnYtbF)
|
||||
|
||||
## Contribute
|
||||
|
||||
- Read our contribution [guidelines](https://github.com/sern-handler/handler) carefully
|
||||
- Pull up on [issues](https://github.com/sern-handler/handler/issues) and report bugs
|
||||
- All kinds of contributions are welcomed.
|
||||
|
||||
## Roadmap
|
||||
|
||||
You can check our [roadmap](https://github.com/sern-handler/roadmap) to see what's going to be added or patched in the future.
|
||||
43
docs/api/interfaces/Controller.md
Normal file
43
docs/api/interfaces/Controller.md
Normal file
@@ -0,0 +1,43 @@
|
||||
---
|
||||
id: "Controller"
|
||||
title: "Interface: Controller"
|
||||
sidebar_label: "Controller"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
## Properties
|
||||
|
||||
### next
|
||||
|
||||
• **next**: () => `Ok`<`void`\>
|
||||
|
||||
#### Type declaration
|
||||
|
||||
▸ (): `Ok`<`void`\>
|
||||
|
||||
##### Returns
|
||||
|
||||
`Ok`<`void`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/handler/plugins/plugin.ts:29](https://github.com/sern-handler/handler/blob/2009593/src/handler/plugins/plugin.ts#L29)
|
||||
|
||||
___
|
||||
|
||||
### stop
|
||||
|
||||
• **stop**: () => `Err`<`void`\>
|
||||
|
||||
#### Type declaration
|
||||
|
||||
▸ (): `Err`<`void`\>
|
||||
|
||||
##### Returns
|
||||
|
||||
`Err`<`void`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/handler/plugins/plugin.ts:30](https://github.com/sern-handler/handler/blob/2009593/src/handler/plugins/plugin.ts#L30)
|
||||
59
docs/api/interfaces/Wrapper.md
Normal file
59
docs/api/interfaces/Wrapper.md
Normal file
@@ -0,0 +1,59 @@
|
||||
---
|
||||
id: "Wrapper"
|
||||
title: "Interface: Wrapper"
|
||||
sidebar_label: "Wrapper"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
An object to be passed into Sern#init() function.
|
||||
|
||||
## Properties
|
||||
|
||||
### client
|
||||
|
||||
• `Readonly` **client**: `Client`<`boolean`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/handler/structures/wrapper.ts:10](https://github.com/sern-handler/handler/blob/2009593/src/handler/structures/wrapper.ts#L10)
|
||||
|
||||
___
|
||||
|
||||
### commands
|
||||
|
||||
• `Readonly` **commands**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/handler/structures/wrapper.ts:13](https://github.com/sern-handler/handler/blob/2009593/src/handler/structures/wrapper.ts#L13)
|
||||
|
||||
___
|
||||
|
||||
### defaultPrefix
|
||||
|
||||
• `Optional` `Readonly` **defaultPrefix**: `string`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/handler/structures/wrapper.ts:12](https://github.com/sern-handler/handler/blob/2009593/src/handler/structures/wrapper.ts#L12)
|
||||
|
||||
___
|
||||
|
||||
### events
|
||||
|
||||
• `Optional` `Readonly` **events**: `string` \| { `absPath`: `string` ; `mod`: `EventModule` }[] \| () => { `absPath`: `string` ; `mod`: `EventModule` }[]
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/handler/structures/wrapper.ts:14](https://github.com/sern-handler/handler/blob/2009593/src/handler/structures/wrapper.ts#L14)
|
||||
|
||||
___
|
||||
|
||||
### sernEmitter
|
||||
|
||||
• `Optional` `Readonly` **sernEmitter**: [`SernEmitter`](../classes/SernEmitter.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/handler/structures/wrapper.ts:11](https://github.com/sern-handler/handler/blob/2009593/src/handler/structures/wrapper.ts#L11)
|
||||
2
docs/api/interfaces/_category_.yml
Normal file
2
docs/api/interfaces/_category_.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
label: "Interfaces"
|
||||
position: 4
|
||||
627
docs/api/modules.md
Normal file
627
docs/api/modules.md
Normal file
@@ -0,0 +1,627 @@
|
||||
---
|
||||
id: "modules"
|
||||
title: "@sern/handler"
|
||||
sidebar_label: "Exports"
|
||||
sidebar_position: 0.5
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
## Namespaces
|
||||
|
||||
- [Sern](namespaces/Sern.md)
|
||||
|
||||
## Enumerations
|
||||
|
||||
- [CommandType](enums/CommandType.md)
|
||||
- [EventType](enums/EventType.md)
|
||||
- [PayloadType](enums/PayloadType.md)
|
||||
- [PluginType](enums/PluginType.md)
|
||||
|
||||
## Classes
|
||||
|
||||
- [Context](classes/Context.md)
|
||||
- [SernEmitter](classes/SernEmitter.md)
|
||||
|
||||
## Interfaces
|
||||
|
||||
- [Controller](interfaces/Controller.md)
|
||||
- [Wrapper](interfaces/Wrapper.md)
|
||||
|
||||
## Type Aliases
|
||||
|
||||
### Args
|
||||
|
||||
Ƭ **Args**: [`ParseType`](modules.md#parsetype)<{ `slash`: [`SlashOptions`](modules.md#slashoptions) ; `text`: `string`[] }\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/types/handler.ts:11](https://github.com/sern-handler/handler/blob/2009593/src/types/handler.ts#L11)
|
||||
|
||||
___
|
||||
|
||||
### AutocompletePlugin
|
||||
|
||||
Ƭ **AutocompletePlugin**: [`Override`](modules.md#override)<`BaseModule`, { `execute`: (`autocmp`: `AutocompleteInteraction`, `controlller`: [`Controller`](interfaces/Controller.md)) => `Awaitable`<`Result`<`void`, `void`\>\> ; `type`: [`Event`](enums/PluginType.md#event) }\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/handler/plugins/plugin.ts:92](https://github.com/sern-handler/handler/blob/2009593/src/handler/plugins/plugin.ts#L92)
|
||||
|
||||
___
|
||||
|
||||
### BaseOptions
|
||||
|
||||
Ƭ **BaseOptions**: `ApplicationCommandChoicesData` \| `ApplicationCommandNonOptionsData` \| `ApplicationCommandChannelOptionData` \| `ApplicationCommandNumericOptionData` \| `ApplicationCommandAttachmentOption` \| [`SernAutocompleteData`](modules.md#sernautocompletedata)
|
||||
|
||||
Type that replaces autocomplete with [SernAutocompleteData](modules.md#sernautocompletedata)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/handler/structures/module.ts:181](https://github.com/sern-handler/handler/blob/2009593/src/handler/structures/module.ts#L181)
|
||||
|
||||
___
|
||||
|
||||
### BothCommand
|
||||
|
||||
Ƭ **BothCommand**: [`Override`](modules.md#override)<`BaseModule`, { `alias?`: `string`[] ; `execute`: (`ctx`: [`Context`](classes/Context.md), `args`: [`Args`](modules.md#args)) => `Awaitable`<`void` \| `unknown`\> ; `onEvent`: [`EventPlugin`](modules.md#eventplugin)<[`Both`](enums/CommandType.md#both)\>[] ; `options?`: [`SernOptionsData`](modules.md#sernoptionsdata)[] ; `plugins`: [`CommandPlugin`](modules.md#commandplugin)[] ; `type`: [`Both`](enums/CommandType.md#both) }\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/handler/structures/module.ts:55](https://github.com/sern-handler/handler/blob/2009593/src/handler/structures/module.ts#L55)
|
||||
|
||||
___
|
||||
|
||||
### CommandModuleNoPlugins
|
||||
|
||||
Ƭ **CommandModuleNoPlugins**: { [T in CommandType]: Omit<CommandModuleDefs[T], "plugins" \| "onEvent"\> }
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/handler/plugins/plugin.ts:145](https://github.com/sern-handler/handler/blob/2009593/src/handler/plugins/plugin.ts#L145)
|
||||
|
||||
___
|
||||
|
||||
### CommandModulePlugin
|
||||
|
||||
Ƭ **CommandModulePlugin**<`T`\>: [`EventPlugin`](modules.md#eventplugin)<`T`\> \| [`CommandPlugin`](modules.md#commandplugin)<`T`\>
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `T` | extends [`CommandType`](enums/CommandType.md) |
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/handler/plugins/plugin.ts:173](https://github.com/sern-handler/handler/blob/2009593/src/handler/plugins/plugin.ts#L173)
|
||||
|
||||
___
|
||||
|
||||
### CommandPlugin
|
||||
|
||||
Ƭ **CommandPlugin**<`T`\>: { [K in T]: Override<BasePlugin, Object\> }[`T`]
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `T` | extends keyof `CommandModuleDefs` = keyof `CommandModuleDefs` |
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/handler/plugins/plugin.ts:40](https://github.com/sern-handler/handler/blob/2009593/src/handler/plugins/plugin.ts#L40)
|
||||
|
||||
___
|
||||
|
||||
### DefinedCommandModule
|
||||
|
||||
Ƭ **DefinedCommandModule**: [`DefinitelyDefined`](modules.md#definitelydefined)<`CommandModule`, ``"name"`` \| ``"description"``\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/types/handler.ts:48](https://github.com/sern-handler/handler/blob/2009593/src/types/handler.ts#L48)
|
||||
|
||||
___
|
||||
|
||||
### DefinedEventModule
|
||||
|
||||
Ƭ **DefinedEventModule**: [`DefinitelyDefined`](modules.md#definitelydefined)<`EventModule`, ``"name"`` \| ``"description"``\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/types/handler.ts:49](https://github.com/sern-handler/handler/blob/2009593/src/types/handler.ts#L49)
|
||||
|
||||
___
|
||||
|
||||
### DefinedModule
|
||||
|
||||
Ƭ **DefinedModule**: [`DefinitelyDefined`](modules.md#definitelydefined)<[`Module`](modules.md#module), ``"name"`` \| ``"description"``\>
|
||||
|
||||
After modules are transformed, name and description are given default values if none
|
||||
are provided to Module. This type represents that transformation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/types/handler.ts:47](https://github.com/sern-handler/handler/blob/2009593/src/types/handler.ts#L47)
|
||||
|
||||
___
|
||||
|
||||
### DefinitelyDefined
|
||||
|
||||
Ƭ **DefinitelyDefined**<`T`, `K`\>: { [L in K]-?: T[L] extends Record<string, unknown\> ? DefinitelyDefined<T[L], keyof T[L]\> : Required<T\>[L] } & `T`
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `T` | `T` |
|
||||
| `K` | extends keyof `T` = keyof `T` |
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/types/handler.ts:18](https://github.com/sern-handler/handler/blob/2009593/src/types/handler.ts#L18)
|
||||
|
||||
___
|
||||
|
||||
### DiscordEmitterPlugin
|
||||
|
||||
Ƭ **DiscordEmitterPlugin**: [`Override`](modules.md#override)<`BasePlugin`, { `execute`: (`wrapper`: `Client`, `module`: [`DefinitelyDefined`](modules.md#definitelydefined)<`DiscordEventCommand`, ``"name"`` \| ``"description"``\>, `controller`: [`Controller`](interfaces/Controller.md)) => `Awaitable`<`Result`<`void`, `void`\>\> ; `type`: [`Command`](enums/PluginType.md#command) }\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/handler/plugins/plugin.ts:57](https://github.com/sern-handler/handler/blob/2009593/src/handler/plugins/plugin.ts#L57)
|
||||
|
||||
___
|
||||
|
||||
### DiscordEventPlugin
|
||||
|
||||
Ƭ **DiscordEventPlugin**<`T`\>: [`Override`](modules.md#override)<`BasePlugin`, { `execute`: (`args`: `ClientEvents`[`T`], `controller`: [`Controller`](interfaces/Controller.md)) => `Awaitable`<`Result`<`void`, `void`\>\> ; `name?`: `T` ; `type`: [`Event`](enums/PluginType.md#event) }\>
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `T` | extends keyof `ClientEvents` = keyof `ClientEvents` |
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/handler/plugins/plugin.ts:136](https://github.com/sern-handler/handler/blob/2009593/src/handler/plugins/plugin.ts#L136)
|
||||
|
||||
___
|
||||
|
||||
### EventInput
|
||||
|
||||
Ƭ **EventInput**: `string` \| { `absPath`: `string` ; `mod`: `EventModule` }[] \| () => { `absPath`: `string` ; `mod`: `EventModule` }[]
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/types/handler.ts:24](https://github.com/sern-handler/handler/blob/2009593/src/types/handler.ts#L24)
|
||||
|
||||
___
|
||||
|
||||
### EventModuleCommandPluginDefs
|
||||
|
||||
Ƭ **EventModuleCommandPluginDefs**: `Object`
|
||||
|
||||
Event Module Command Plugins
|
||||
|
||||
#### Type declaration
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `1` | [`DiscordEmitterPlugin`](modules.md#discordemitterplugin) |
|
||||
| `2` | [`SernEmitterPlugin`](modules.md#sernemitterplugin) |
|
||||
| `3` | [`ExternalEmitterPlugin`](modules.md#externalemitterplugin) |
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/handler/plugins/plugin.ts:163](https://github.com/sern-handler/handler/blob/2009593/src/handler/plugins/plugin.ts#L163)
|
||||
|
||||
___
|
||||
|
||||
### EventModuleEventPluginDefs
|
||||
|
||||
Ƭ **EventModuleEventPluginDefs**: `Object`
|
||||
|
||||
Event Module Event Plugins
|
||||
|
||||
#### Type declaration
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `1` | [`DiscordEventPlugin`](modules.md#discordeventplugin) |
|
||||
| `2` | [`SernEventPlugin`](modules.md#serneventplugin) |
|
||||
| `3` | [`ExternalEventPlugin`](modules.md#externaleventplugin) |
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/handler/plugins/plugin.ts:154](https://github.com/sern-handler/handler/blob/2009593/src/handler/plugins/plugin.ts#L154)
|
||||
|
||||
___
|
||||
|
||||
### EventModulePlugin
|
||||
|
||||
Ƭ **EventModulePlugin**<`T`\>: [`EventModuleEventPluginDefs`](modules.md#eventmoduleeventplugindefs)[`T`] \| [`EventModuleCommandPluginDefs`](modules.md#eventmodulecommandplugindefs)[`T`]
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `T` | extends [`EventType`](enums/EventType.md) |
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/handler/plugins/plugin.ts:169](https://github.com/sern-handler/handler/blob/2009593/src/handler/plugins/plugin.ts#L169)
|
||||
|
||||
___
|
||||
|
||||
### EventModulesNoPlugins
|
||||
|
||||
Ƭ **EventModulesNoPlugins**: { [T in EventType]: Omit<EventModuleDefs[T], "plugins" \| "onEvent"\> }
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/handler/plugins/plugin.ts:148](https://github.com/sern-handler/handler/blob/2009593/src/handler/plugins/plugin.ts#L148)
|
||||
|
||||
___
|
||||
|
||||
### EventPlugin
|
||||
|
||||
Ƭ **EventPlugin**<`T`\>: { [K in T]: Override<BasePlugin, Object\> }[`T`]
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `T` | extends keyof `CommandModuleDefs` = keyof `CommandModuleDefs` |
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/handler/plugins/plugin.ts:103](https://github.com/sern-handler/handler/blob/2009593/src/handler/plugins/plugin.ts#L103)
|
||||
|
||||
___
|
||||
|
||||
### ExternalEmitterPlugin
|
||||
|
||||
Ƭ **ExternalEmitterPlugin**<`T`\>: [`Override`](modules.md#override)<`BasePlugin`, { `execute`: (`wrapper`: `T`, `module`: [`DefinitelyDefined`](modules.md#definitelydefined)<`ExternalEventCommand`, ``"name"`` \| ``"description"``\>, `controller`: [`Controller`](interfaces/Controller.md)) => `Awaitable`<`Result`<`void`, `void`\>\> ; `type`: [`Command`](enums/PluginType.md#command) }\>
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `T` | extends `EventEmitter` = `EventEmitter` |
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/handler/plugins/plugin.ts:68](https://github.com/sern-handler/handler/blob/2009593/src/handler/plugins/plugin.ts#L68)
|
||||
|
||||
___
|
||||
|
||||
### ExternalEventPlugin
|
||||
|
||||
Ƭ **ExternalEventPlugin**: [`Override`](modules.md#override)<`BasePlugin`, { `execute`: (`args`: `unknown`[], `controller`: [`Controller`](interfaces/Controller.md)) => `Awaitable`<`Result`<`void`, `void`\>\> ; `type`: [`Event`](enums/PluginType.md#event) }\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/handler/plugins/plugin.ts:128](https://github.com/sern-handler/handler/blob/2009593/src/handler/plugins/plugin.ts#L128)
|
||||
|
||||
___
|
||||
|
||||
### InputCommandModule
|
||||
|
||||
Ƭ **InputCommandModule**: { [T in CommandType]: CommandModuleNoPlugins[T] & Object }[[`CommandType`](enums/CommandType.md)]
|
||||
|
||||
User inputs this type. Sern processes behind the scenes for better usage
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/handler/plugins/plugin.ts:178](https://github.com/sern-handler/handler/blob/2009593/src/handler/plugins/plugin.ts#L178)
|
||||
|
||||
___
|
||||
|
||||
### InputEventModule
|
||||
|
||||
Ƭ **InputEventModule**: { [T in EventType]: EventModulesNoPlugins[T] & Object }[[`EventType`](enums/EventType.md)]
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/handler/plugins/plugin.ts:182](https://github.com/sern-handler/handler/blob/2009593/src/handler/plugins/plugin.ts#L182)
|
||||
|
||||
___
|
||||
|
||||
### IsOptional
|
||||
|
||||
Ƭ **IsOptional**<`T`\>: { [K in keyof T]-?: T[K] extends Required<T\>[K] ? false : true }
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `T` |
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/types/handler.ts:31](https://github.com/sern-handler/handler/blob/2009593/src/types/handler.ts#L31)
|
||||
|
||||
___
|
||||
|
||||
### Module
|
||||
|
||||
Ƭ **Module**: `CommandModule` \| `EventModule`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/handler/structures/module.ts:141](https://github.com/sern-handler/handler/blob/2009593/src/handler/structures/module.ts#L141)
|
||||
|
||||
___
|
||||
|
||||
### Nullish
|
||||
|
||||
Ƭ **Nullish**<`T`\>: `T` \| `undefined` \| ``null``
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `T` |
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/types/handler.ts:4](https://github.com/sern-handler/handler/blob/2009593/src/types/handler.ts#L4)
|
||||
|
||||
___
|
||||
|
||||
### Override
|
||||
|
||||
Ƭ **Override**<`T1`, `T2`\>: `Omit`<`T1`, keyof `T2`\> & `T2`
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `T1` |
|
||||
| `T2` |
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/types/handler.ts:16](https://github.com/sern-handler/handler/blob/2009593/src/types/handler.ts#L16)
|
||||
|
||||
___
|
||||
|
||||
### ParseType
|
||||
|
||||
Ƭ **ParseType**<`T`\>: { [K in keyof T]: T[K] extends unknown ? [k: K, args: T[K]] : never }[keyof `T`]
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `T` |
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/types/handler.ts:7](https://github.com/sern-handler/handler/blob/2009593/src/types/handler.ts#L7)
|
||||
|
||||
___
|
||||
|
||||
### Payload
|
||||
|
||||
Ƭ **Payload**: { `module`: [`Module`](modules.md#module) ; `type`: [`Success`](enums/PayloadType.md#success) } \| { `module`: [`Module`](modules.md#module) \| `undefined` ; `reason`: `string` \| `Error` ; `type`: [`Failure`](enums/PayloadType.md#failure) }
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/types/handler.ts:50](https://github.com/sern-handler/handler/blob/2009593/src/types/handler.ts#L50)
|
||||
|
||||
___
|
||||
|
||||
### Reconstruct
|
||||
|
||||
Ƭ **Reconstruct**<`T`\>: `T` extends `Omit`<infer O, `never`\> ? `O` & [`Reconstruct`](modules.md#reconstruct)<`O`\> : `T`
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `T` |
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/types/handler.ts:29](https://github.com/sern-handler/handler/blob/2009593/src/types/handler.ts#L29)
|
||||
|
||||
___
|
||||
|
||||
### SernAutocompleteData
|
||||
|
||||
Ƭ **SernAutocompleteData**: [`Override`](modules.md#override)<`BaseApplicationCommandOptionsData`, { `autocomplete`: ``true`` ; `command`: `AutocompleteCommand` ; `type`: `ApplicationCommandOptionType.String` \| `ApplicationCommandOptionType.Number` \| `ApplicationCommandOptionType.Integer` }\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/handler/structures/module.ts:166](https://github.com/sern-handler/handler/blob/2009593/src/handler/structures/module.ts#L166)
|
||||
|
||||
___
|
||||
|
||||
### SernEmitterPlugin
|
||||
|
||||
Ƭ **SernEmitterPlugin**: [`Override`](modules.md#override)<`BasePlugin`, { `execute`: (`wrapper`: [`SernEmitter`](classes/SernEmitter.md), `module`: [`DefinitelyDefined`](modules.md#definitelydefined)<`SernEventCommand`, ``"name"`` \| ``"description"``\>, `controller`: [`Controller`](interfaces/Controller.md)) => `Awaitable`<`Result`<`void`, `void`\>\> ; `type`: [`Command`](enums/PluginType.md#command) }\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/handler/plugins/plugin.ts:80](https://github.com/sern-handler/handler/blob/2009593/src/handler/plugins/plugin.ts#L80)
|
||||
|
||||
___
|
||||
|
||||
### SernEventPlugin
|
||||
|
||||
Ƭ **SernEventPlugin**<`T`\>: [`Override`](modules.md#override)<`BasePlugin`, { `execute`: (`args`: [`SernEventsMapping`](modules.md#serneventsmapping)[`T`], `controller`: [`Controller`](interfaces/Controller.md)) => `Awaitable`<`Result`<`void`, `void`\>\> ; `name?`: `T` ; `type`: [`Event`](enums/PluginType.md#event) }\>
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `T` | extends keyof [`SernEventsMapping`](modules.md#serneventsmapping) = keyof [`SernEventsMapping`](modules.md#serneventsmapping) |
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/handler/plugins/plugin.ts:116](https://github.com/sern-handler/handler/blob/2009593/src/handler/plugins/plugin.ts#L116)
|
||||
|
||||
___
|
||||
|
||||
### SernEventsMapping
|
||||
|
||||
Ƭ **SernEventsMapping**: `Object`
|
||||
|
||||
#### Type declaration
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `error` | [`Error` \| `string`] |
|
||||
| `module.activate` | [[`Payload`](modules.md#payload)] |
|
||||
| `module.register` | [[`Payload`](modules.md#payload)] |
|
||||
| `warning` | [`string`] |
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/types/handler.ts:53](https://github.com/sern-handler/handler/blob/2009593/src/types/handler.ts#L53)
|
||||
|
||||
___
|
||||
|
||||
### SernOptionsData
|
||||
|
||||
Ƭ **SernOptionsData**<`U`\>: `U` extends `ApplicationCommandSubCommandData` ? [`SernSubCommandData`](modules.md#sernsubcommanddata) : `U` extends `ApplicationCommandSubGroupData` ? [`SernSubCommandGroupData`](modules.md#sernsubcommandgroupdata) : [`BaseOptions`](modules.md#baseoptions)
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `U` | extends `ApplicationCommandOptionData` = `ApplicationCommandOptionData` |
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/handler/structures/module.ts:205](https://github.com/sern-handler/handler/blob/2009593/src/handler/structures/module.ts#L205)
|
||||
|
||||
___
|
||||
|
||||
### SernSubCommandData
|
||||
|
||||
Ƭ **SernSubCommandData**: [`Override`](modules.md#override)<`Omit`<`BaseApplicationCommandOptionsData`, ``"required"``\>, { `options?`: [`BaseOptions`](modules.md#baseoptions)[] ; `type`: `ApplicationCommandOptionType.Subcommand` }\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/handler/structures/module.ts:189](https://github.com/sern-handler/handler/blob/2009593/src/handler/structures/module.ts#L189)
|
||||
|
||||
___
|
||||
|
||||
### SernSubCommandGroupData
|
||||
|
||||
Ƭ **SernSubCommandGroupData**: [`Override`](modules.md#override)<`Omit`<`BaseApplicationCommandOptionsData`, ``"required"``\>, { `options?`: [`SernSubCommandData`](modules.md#sernsubcommanddata)[] ; `type`: `ApplicationCommandOptionType.SubcommandGroup` }\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/handler/structures/module.ts:197](https://github.com/sern-handler/handler/blob/2009593/src/handler/structures/module.ts#L197)
|
||||
|
||||
___
|
||||
|
||||
### SlashCommand
|
||||
|
||||
Ƭ **SlashCommand**: [`Override`](modules.md#override)<`BaseModule`, { `execute`: (`ctx`: [`Context`](classes/Context.md), `args`: [``"slash"``, [`SlashOptions`](modules.md#slashoptions)]) => `Awaitable`<`void` \| `unknown`\> ; `onEvent`: [`EventPlugin`](modules.md#eventplugin)<[`Slash`](enums/CommandType.md#slash)\>[] ; `options?`: [`SernOptionsData`](modules.md#sernoptionsdata)[] ; `plugins`: [`CommandPlugin`](modules.md#commandplugin)[] ; `type`: [`Slash`](enums/CommandType.md#slash) }\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/handler/structures/module.ts:44](https://github.com/sern-handler/handler/blob/2009593/src/handler/structures/module.ts#L44)
|
||||
|
||||
___
|
||||
|
||||
### SlashOptions
|
||||
|
||||
Ƭ **SlashOptions**: `Omit`<`CommandInteractionOptionResolver`, ``"getMessage"`` \| ``"getFocused"``\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/types/handler.ts:13](https://github.com/sern-handler/handler/blob/2009593/src/types/handler.ts#L13)
|
||||
|
||||
___
|
||||
|
||||
### SpreadParams
|
||||
|
||||
Ƭ **SpreadParams**<`T`\>: (`args`: `Parameters`<`T`\>[`number`]) => `unknown`
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `T` | extends (...`args`: `never`) => `unknown` |
|
||||
|
||||
#### Type declaration
|
||||
|
||||
▸ (`args`): `unknown`
|
||||
|
||||
Turns a function with a union of array of args into a single union
|
||||
[ T , V , B ] | [ A ] => T | V | B | A
|
||||
|
||||
##### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `args` | `Parameters`<`T`\>[`number`] |
|
||||
|
||||
##### Returns
|
||||
|
||||
`unknown`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/types/handler.ts:39](https://github.com/sern-handler/handler/blob/2009593/src/types/handler.ts#L39)
|
||||
|
||||
___
|
||||
|
||||
### TextCommand
|
||||
|
||||
Ƭ **TextCommand**: [`Override`](modules.md#override)<`BaseModule`, { `alias?`: `string`[] ; `execute`: (`ctx`: [`Context`](classes/Context.md), `args`: [``"text"``, `string`[]]) => `Awaitable`<`void` \| `unknown`\> ; `onEvent`: [`EventPlugin`](modules.md#eventplugin)<[`Text`](enums/CommandType.md#text)\>[] ; `plugins`: [`CommandPlugin`](modules.md#commandplugin)[] ; `type`: [`Text`](enums/CommandType.md#text) }\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/handler/structures/module.ts:33](https://github.com/sern-handler/handler/blob/2009593/src/handler/structures/module.ts#L33)
|
||||
|
||||
## Functions
|
||||
|
||||
### commandModule
|
||||
|
||||
▸ **commandModule**(`mod`): `CommandModule`
|
||||
|
||||
The wrapper function to define command modules for sern
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `mod` | [`InputCommandModule`](modules.md#inputcommandmodule) |
|
||||
|
||||
#### Returns
|
||||
|
||||
`CommandModule`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/handler/sern.ts:86](https://github.com/sern-handler/handler/blob/2009593/src/handler/sern.ts#L86)
|
||||
|
||||
___
|
||||
|
||||
### eventModule
|
||||
|
||||
▸ **eventModule**(`mod`): `EventModule`
|
||||
|
||||
The wrapper function to define event modules for sern
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `mod` | [`InputEventModule`](modules.md#inputeventmodule) |
|
||||
|
||||
#### Returns
|
||||
|
||||
`EventModule`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/handler/sern.ts:107](https://github.com/sern-handler/handler/blob/2009593/src/handler/sern.ts#L107)
|
||||
114
docs/api/namespaces/Sern.md
Normal file
114
docs/api/namespaces/Sern.md
Normal file
@@ -0,0 +1,114 @@
|
||||
---
|
||||
id: "Sern"
|
||||
title: "Namespace: Sern"
|
||||
sidebar_label: "Sern"
|
||||
sidebar_position: 0
|
||||
custom_edit_url: null
|
||||
---
|
||||
|
||||
## References
|
||||
|
||||
### commandModule
|
||||
|
||||
Re-exports [commandModule](../modules.md#commandmodule)
|
||||
|
||||
___
|
||||
|
||||
### eventModule
|
||||
|
||||
Re-exports [eventModule](../modules.md#eventmodule)
|
||||
|
||||
## Variables
|
||||
|
||||
### controller
|
||||
|
||||
• `Const` **controller**: `Object`
|
||||
|
||||
The object passed into every plugin to control a command's behavior
|
||||
|
||||
#### Type declaration
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `next` | () => `OkImpl`<`void`\> |
|
||||
| `stop` | () => `ErrImpl`<`void`\> |
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/handler/sern.ts:77](https://github.com/sern-handler/handler/blob/2009593/src/handler/sern.ts#L77)
|
||||
|
||||
## Functions
|
||||
|
||||
### addExternal
|
||||
|
||||
▸ **addExternal**<`T`\>(`emitter`): `void`
|
||||
|
||||
**`Example`**
|
||||
|
||||
```ts title="src/index.ts"
|
||||
//Add this before initiating Sern!
|
||||
Sern.addExternal(new Level())
|
||||
```
|
||||
|
||||
**`Example`**
|
||||
|
||||
```ts title="events/level.ts"
|
||||
export default eventModule({
|
||||
emitter: 'Level',
|
||||
type : EventType.External,
|
||||
name: 'error',
|
||||
execute(args) {
|
||||
console.log(args)
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `T` | extends `__module` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `emitter` | `T` | Any external event emitter. The object will be stored in a map, and then fetched by the name of the instance's class. As there are infinite possibilities to adding external event emitters, Most types aren't provided and are as narrow as possibly can. |
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/handler/sern.ts:67](https://github.com/sern-handler/handler/blob/2009593/src/handler/sern.ts#L67)
|
||||
|
||||
___
|
||||
|
||||
### init
|
||||
|
||||
▸ **init**(`wrapper`): `void`
|
||||
|
||||
**`Example`**
|
||||
|
||||
```ts title="src/index.ts"
|
||||
Sern.init({
|
||||
client,
|
||||
defaultPrefix: '!',
|
||||
commands: 'dist/commands',
|
||||
})
|
||||
```
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `wrapper` | [`Wrapper`](../interfaces/Wrapper.md) | Options to pass into sern. Function to start the handler up |
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[src/handler/sern.ts:34](https://github.com/sern-handler/handler/blob/2009593/src/handler/sern.ts#L34)
|
||||
2
docs/api/namespaces/_category_.yml
Normal file
2
docs/api/namespaces/_category_.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
label: "Namespaces"
|
||||
position: 1
|
||||
Reference in New Issue
Block a user