Compare commits

...

66 Commits

Author SHA1 Message Date
Evo
4812106ff0 chore: rebased api update branch (#65)
Co-authored-by: Jacob Nguyen <76754747+jacoobes@users.noreply.github.com>
Co-authored-by: xxDeveloper <77380166+Murtatrxx@users.noreply.github.com>
2022-06-28 12:32:11 -05:00
Jacob Nguyen
d6bfd45782 fix: load external event emitters correctly 2022-06-28 11:09:37 -05:00
Jacob Nguyen
237179f590 fix: forgot to add required type property in comment 2022-06-28 10:40:23 -05:00
Jacob Nguyen
ea8cb4ddd1 docs(sern.ts): add comments for addExternal 2022-06-28 10:38:09 -05:00
Jacob Nguyen
9fbd890db8 build: bump version to 1.1.0-beta 2022-06-28 10:30:52 -05:00
Jacob Nguyen
db217f5533 build: delete test.yml, change .prettierignore 2022-06-28 10:18:08 -05:00
Jacob Nguyen
cf3bb412d5 build: remove 'tests' exclude 2022-06-28 10:00:15 -05:00
Jacob Nguyen
84ff217d7f feat: add absPath into commandPlugins! 2022-06-27 15:54:13 -05:00
Jacob Nguyen
4f520b2e5a style: add comment 2022-06-27 15:49:09 -05:00
Jacob Nguyen
4c2a7e8c90 style: eslint 2022-06-27 14:24:54 -05:00
Jacob Nguyen
9320d4395a feat: change from client -> wrapper 2022-06-27 13:47:09 -05:00
Jacob Nguyen
451eebae7e feat: throw error on plugin usage for event listeners 2022-06-27 13:46:04 -05:00
Jacob Nguyen
9271f103ea feat: throw error on plugin usage for event listeners 2022-06-27 13:20:00 -05:00
Jacob Nguyen
a6d309ab5a refactor: add asyncResolveArray.ts to resolve Awaitables easier 2022-06-27 12:35:07 -05:00
Jacob Nguyen
1b447e3c4f feat: Add more plugin definitions 2022-06-26 23:04:36 -05:00
Jacob Nguyen
c3b16b43ce feat: Add more typings for event modules 2022-06-26 12:51:21 -05:00
Jacob Nguyen
ce06e8158a feat: add enum for event modules 2022-06-24 21:33:18 -05:00
Jacob Nguyen
29b0064329 feat: Separating events from command modules, leads separation of responsibility 2022-06-24 21:33:04 -05:00
Jacob Nguyen
27be769228 feat: move new things to top level import 2022-06-24 15:53:49 -05:00
Jacob Nguyen
106d3d61f9 build: bump to 1.0.4-beta 2022-06-24 11:42:20 -05:00
Jacob Nguyen
5607e6d711 build(package.json): bump version 2022-06-24 10:48:55 -05:00
Jacob Nguyen
dea8fc05b1 fix: Crash on interactionCreate event 2022-06-24 10:45:52 -05:00
Jacob Nguyen
8e037988d5 feat: Add basic event handling, no plugins checked yet! 2022-06-24 00:21:35 -05:00
Jacob Nguyen
c56c3c9a8f fix: complying to djs v14 build 2022-06-23 23:58:08 -05:00
Jacob Nguyen
70ef4a0f8f feat: more progress on event handling 2022-06-20 14:20:41 -05:00
Jacob Nguyen
7456933843 feat: switch to match expression, add docs 2022-06-20 10:43:23 -05:00
Jacob Nguyen
df2e178394 refactor: Adding some type aliases 2022-06-19 18:06:44 -05:00
Jacob Nguyen
62c8fb0e1c feat: Changing types of wrapper for external and sern emitter 2022-06-18 02:16:17 -05:00
Jacob Nguyen
878f67391b refactor: Cleaning up and adding docs 2022-06-18 02:15:37 -05:00
Jacob Nguyen
f020af7062 feat: Cleaning up types 2022-06-17 22:25:19 -05:00
Jacob Nguyen
c56dcc62f3 feat: more event handling progress 2022-06-17 14:54:18 -05:00
Jacob Nguyen
d42ab26417 fix: re add import after rebase 2022-06-16 20:22:01 -05:00
Jacob Nguyen
24cd260531 feat: more support for event loading!! 2022-06-16 20:11:58 -05:00
xxDeveloper
440c9ffd9b style: Improved readyEvent.ts comments 2022-06-16 21:56:28 +03:00
xxDeveloper
9c88951646 style: Improved plugin.ts comments 2022-06-16 21:55:44 +03:00
xxDeveloper
6a983a5eae style: Improved plugin.ts comments 2022-06-15 23:43:22 +03:00
Jacob Nguyen
c17af196fb feat: rolling out more event loading support 2022-06-15 13:02:33 -05:00
Jacob Nguyen
60e7cc2369 feat: revamp module types to support event plugins 2022-06-14 14:47:07 -05:00
Jacob Nguyen
3ccfe6633b refactor: type changes to adjust to event commands 2022-06-14 14:29:25 -05:00
Jacob Nguyen
812974ebb6 feat: add events.ts for more customizable event handling 2022-06-14 14:16:55 -05:00
Jacob Nguyen
cccfecc325 feat: add generic to readFile.ts buildData, adding different event loading strategies 2022-06-14 09:39:29 -05:00
Jacob Nguyen
0fc0782e55 feat: change typings of sern emitter 2022-06-13 01:18:23 -05:00
Jacob Nguyen
120c527b34 feat: loading strategy slightly changed, does not throw error on finding no module in file 2022-06-13 01:17:47 -05:00
Jacob Nguyen
4f7f3b6212 feat: remove docs folder 2022-06-12 13:51:12 -05:00
Jacob Nguyen
8070382229 Merge branch 'api-update' of https://github.com/sern-handler/handler into api-update 2022-06-12 13:49:56 -05:00
Jacob Nguyen
513fffed4b feat: remove edit context method for future 2022-06-12 13:49:32 -05:00
xxDeveloper
232705ca37 fix: Fixed typo at SECURITY.md file 2022-06-11 19:47:58 +03:00
xxDeveloper
7242d8fed1 chore(deps): Removed typedoc
Removed typedoc dependency due we won't use it anymore
2022-06-11 19:44:08 +03:00
Jacob Nguyen
0cc701448b build: update discord.js to latest 2022-06-09 14:34:16 -05:00
Jacob Nguyen
06054db655 fix: intellij warnings 2022-06-08 13:46:31 -05:00
Jacob Nguyen
6be1eea20a feat: Add .edit method and let .reply accept string 2022-06-08 13:46:13 -05:00
xxDeveloper
04517e113f chore: Improved package.json 2022-06-08 12:17:32 -05:00
Jacob Nguyen
028837e1c9 docs: Highly encourage to use cli 2022-06-08 12:17:32 -05:00
Jacob Nguyen
0784c077f5 Update README.md 2022-06-08 12:17:32 -05:00
Jacob Nguyen
231ae24065 feat: Make name and description defined when making plugins! 2022-06-08 11:31:16 -05:00
Jacob Nguyen
ef64d9e99c fix: forget to add SernEvent to Wrapper declaration 2022-06-06 01:01:55 -05:00
Jacob Nguyen
72ceede26a feat: remove jest.config.ts 2022-06-06 00:57:43 -05:00
Jacob Nguyen
5fbd3a6d68 feat: add sern events natively register in sern.init 2022-06-06 00:51:09 -05:00
Jacob Nguyen
df2a92cac2 feat: make description optional, default is '...' 2022-06-05 13:58:09 -05:00
Jacob Nguyen
d4ac129b05 feat: narrow typings for args Text and SlashCommand x3 2022-06-05 13:25:56 -05:00
Jacob Nguyen
04dfa82371 fix: Remove type reduction to never in onReady.ts 2022-06-05 13:24:06 -05:00
Jacob Nguyen
ef357e90af feat: make TextCommand and SlashCommand return more specific arg type 2022-06-05 12:42:17 -05:00
Jacob Nguyen
048072bdd7 feat: make TextCommand and SlashCommand return more specific arg type 2022-06-05 11:27:42 -05:00
Jacob Nguyen
18d07d6e2d feat: more clear error for access message or interaction 2022-06-05 11:17:59 -05:00
Jacob Nguyen
6429085650 feat: make command modules return Awaitable void | unknown 2022-06-05 11:11:46 -05:00
Jacob Nguyen
fd85697636 feat: remove unit testing 2022-06-05 11:07:15 -05:00
51 changed files with 774 additions and 17680 deletions

1
.github/CODEOWNERS vendored
View File

@@ -1,2 +1 @@
src/* @jacoobes src/* @jacoobes
docs/* @Murtatrxx

2
.github/SECURITY.md vendored
View File

@@ -14,6 +14,6 @@ Project is currently under heavy development but you can try out our [npm packag
You can report a vulnerability by opening an issue on the [project's GitHub](https://github.com/SernHandler/Sern/issues) repository. You can report a vulnerability by opening an issue on the [project's GitHub](https://github.com/SernHandler/Sern/issues) repository.
Please provide as much information as possible when reporting a vulnerability. We are lookin information for, the affected version, and the steps to reproduce the vulnerability. Please provide as much information as possible when reporting a vulnerability. We are looking information for, the affected version, and the steps to reproduce the vulnerability.
Be patient, we are working on fixing all reported vulnerabilities. Be patient, we are working on fixing all reported vulnerabilities.

View File

@@ -1,29 +0,0 @@
name: Test
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
run-tests:
name: Run Tests
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v1
with:
node-version: 17
- name: Install Node.js dependencies
run: npm ci
- name: Run tests
run: npm test

View File

@@ -1 +1,2 @@
README.md .github/
*.md

View File

@@ -65,12 +65,12 @@ See our [templates](https://github.com/sern-handler/templates) for TypeScript ex
## CLI ## CLI
We are providing a [command line interface](https://github.com/sern-handler/cli) for better & easier bot developement. Don't forget to view it. 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 ## Links
- [Official Documentation](https://sern-handler.js.org) - [Official Documentation](https://sern-handler.js.org)
- [Support Server](https://discord.com/invite/Yvb7DnqjXX) - [Support Server](https://discord.com/invite/mmyCTnYtbF)
## Contribute ## Contribute

View File

@@ -1,3 +0,0 @@
module.exports = {
presets: [['@babel/preset-env', { targets: { node: 'current' } }], '@babel/preset-typescript'],
};

View File

@@ -1 +0,0 @@
TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false.

View File

@@ -1 +0,0 @@
sern-handler.js.org

View File

@@ -1,110 +0,0 @@
:root {
--light-hl-0: #000000;
--dark-hl-0: #d4d4d4;
--light-hl-1: #af00db;
--dark-hl-1: #c586c0;
--light-hl-2: #001080;
--dark-hl-2: #9cdcfe;
--light-hl-3: #a31515;
--dark-hl-3: #ce9178;
--light-hl-4: #0000ff;
--dark-hl-4: #569cd6;
--light-hl-5: #0070c1;
--dark-hl-5: #4fc1ff;
--light-hl-6: #795e26;
--dark-hl-6: #dcdcaa;
--light-hl-7: #008000;
--dark-hl-7: #6a9955;
--light-hl-8: #cd3131;
--dark-hl-8: #f44747;
--light-code-background: #f5f5f5;
--dark-code-background: #1e1e1e;
}
@media (prefers-color-scheme: light) {
:root {
--hl-0: var(--light-hl-0);
--hl-1: var(--light-hl-1);
--hl-2: var(--light-hl-2);
--hl-3: var(--light-hl-3);
--hl-4: var(--light-hl-4);
--hl-5: var(--light-hl-5);
--hl-6: var(--light-hl-6);
--hl-7: var(--light-hl-7);
--hl-8: var(--light-hl-8);
--code-background: var(--light-code-background);
}
}
@media (prefers-color-scheme: dark) {
:root {
--hl-0: var(--dark-hl-0);
--hl-1: var(--dark-hl-1);
--hl-2: var(--dark-hl-2);
--hl-3: var(--dark-hl-3);
--hl-4: var(--dark-hl-4);
--hl-5: var(--dark-hl-5);
--hl-6: var(--dark-hl-6);
--hl-7: var(--dark-hl-7);
--hl-8: var(--dark-hl-8);
--code-background: var(--dark-code-background);
}
}
body.light {
--hl-0: var(--light-hl-0);
--hl-1: var(--light-hl-1);
--hl-2: var(--light-hl-2);
--hl-3: var(--light-hl-3);
--hl-4: var(--light-hl-4);
--hl-5: var(--light-hl-5);
--hl-6: var(--light-hl-6);
--hl-7: var(--light-hl-7);
--hl-8: var(--light-hl-8);
--code-background: var(--light-code-background);
}
body.dark {
--hl-0: var(--dark-hl-0);
--hl-1: var(--dark-hl-1);
--hl-2: var(--dark-hl-2);
--hl-3: var(--dark-hl-3);
--hl-4: var(--dark-hl-4);
--hl-5: var(--dark-hl-5);
--hl-6: var(--dark-hl-6);
--hl-7: var(--dark-hl-7);
--hl-8: var(--dark-hl-8);
--code-background: var(--dark-code-background);
}
.hl-0 {
color: var(--hl-0);
}
.hl-1 {
color: var(--hl-1);
}
.hl-2 {
color: var(--hl-2);
}
.hl-3 {
color: var(--hl-3);
}
.hl-4 {
color: var(--hl-4);
}
.hl-5 {
color: var(--hl-5);
}
.hl-6 {
color: var(--hl-6);
}
.hl-7 {
color: var(--hl-7);
}
.hl-8 {
color: var(--hl-8);
}
pre,
code {
background: var(--code-background);
}

View File

@@ -1,907 +0,0 @@
.tsd-kind-icon {
display: block;
position: relative;
padding-left: 20px;
text-indent: -20px;
}
.tsd-kind-icon:before {
content: '';
display: inline-block;
vertical-align: middle;
width: 17px;
height: 17px;
margin: 0 3px 2px 0;
background-image: url(./icons.png);
}
@media (-webkit-min-device-pixel-ratio: 1.5), (min-resolution: 144dpi) {
.tsd-kind-icon:before {
background-image: url(./icons@2x.png);
background-size: 238px 204px;
}
}
.tsd-signature.tsd-kind-icon:before {
background-position: 0 -153px;
}
.tsd-kind-object-literal > .tsd-kind-icon:before {
background-position: 0px -17px;
}
.tsd-kind-object-literal.tsd-is-protected > .tsd-kind-icon:before {
background-position: -17px -17px;
}
.tsd-kind-object-literal.tsd-is-private > .tsd-kind-icon:before {
background-position: -34px -17px;
}
.tsd-kind-class > .tsd-kind-icon:before {
background-position: 0px -34px;
}
.tsd-kind-class.tsd-is-protected > .tsd-kind-icon:before {
background-position: -17px -34px;
}
.tsd-kind-class.tsd-is-private > .tsd-kind-icon:before {
background-position: -34px -34px;
}
.tsd-kind-class.tsd-has-type-parameter > .tsd-kind-icon:before {
background-position: 0px -51px;
}
.tsd-kind-class.tsd-has-type-parameter.tsd-is-protected > .tsd-kind-icon:before {
background-position: -17px -51px;
}
.tsd-kind-class.tsd-has-type-parameter.tsd-is-private > .tsd-kind-icon:before {
background-position: -34px -51px;
}
.tsd-kind-interface > .tsd-kind-icon:before {
background-position: 0px -68px;
}
.tsd-kind-interface.tsd-is-protected > .tsd-kind-icon:before {
background-position: -17px -68px;
}
.tsd-kind-interface.tsd-is-private > .tsd-kind-icon:before {
background-position: -34px -68px;
}
.tsd-kind-interface.tsd-has-type-parameter > .tsd-kind-icon:before {
background-position: 0px -85px;
}
.tsd-kind-interface.tsd-has-type-parameter.tsd-is-protected > .tsd-kind-icon:before {
background-position: -17px -85px;
}
.tsd-kind-interface.tsd-has-type-parameter.tsd-is-private > .tsd-kind-icon:before {
background-position: -34px -85px;
}
.tsd-kind-namespace > .tsd-kind-icon:before {
background-position: 0px -102px;
}
.tsd-kind-namespace.tsd-is-protected > .tsd-kind-icon:before {
background-position: -17px -102px;
}
.tsd-kind-namespace.tsd-is-private > .tsd-kind-icon:before {
background-position: -34px -102px;
}
.tsd-kind-module > .tsd-kind-icon:before {
background-position: 0px -102px;
}
.tsd-kind-module.tsd-is-protected > .tsd-kind-icon:before {
background-position: -17px -102px;
}
.tsd-kind-module.tsd-is-private > .tsd-kind-icon:before {
background-position: -34px -102px;
}
.tsd-kind-enum > .tsd-kind-icon:before {
background-position: 0px -119px;
}
.tsd-kind-enum.tsd-is-protected > .tsd-kind-icon:before {
background-position: -17px -119px;
}
.tsd-kind-enum.tsd-is-private > .tsd-kind-icon:before {
background-position: -34px -119px;
}
.tsd-kind-enum-member > .tsd-kind-icon:before {
background-position: 0px -136px;
}
.tsd-kind-enum-member.tsd-is-protected > .tsd-kind-icon:before {
background-position: -17px -136px;
}
.tsd-kind-enum-member.tsd-is-private > .tsd-kind-icon:before {
background-position: -34px -136px;
}
.tsd-kind-signature > .tsd-kind-icon:before {
background-position: 0px -153px;
}
.tsd-kind-signature.tsd-is-protected > .tsd-kind-icon:before {
background-position: -17px -153px;
}
.tsd-kind-signature.tsd-is-private > .tsd-kind-icon:before {
background-position: -34px -153px;
}
.tsd-kind-type-alias > .tsd-kind-icon:before {
background-position: 0px -170px;
}
.tsd-kind-type-alias.tsd-is-protected > .tsd-kind-icon:before {
background-position: -17px -170px;
}
.tsd-kind-type-alias.tsd-is-private > .tsd-kind-icon:before {
background-position: -34px -170px;
}
.tsd-kind-type-alias.tsd-has-type-parameter > .tsd-kind-icon:before {
background-position: 0px -187px;
}
.tsd-kind-type-alias.tsd-has-type-parameter.tsd-is-protected > .tsd-kind-icon:before {
background-position: -17px -187px;
}
.tsd-kind-type-alias.tsd-has-type-parameter.tsd-is-private > .tsd-kind-icon:before {
background-position: -34px -187px;
}
.tsd-kind-variable > .tsd-kind-icon:before {
background-position: -136px -0px;
}
.tsd-kind-variable.tsd-is-protected > .tsd-kind-icon:before {
background-position: -153px -0px;
}
.tsd-kind-variable.tsd-is-private > .tsd-kind-icon:before {
background-position: -119px -0px;
}
.tsd-kind-variable.tsd-parent-kind-class > .tsd-kind-icon:before {
background-position: -51px -0px;
}
.tsd-kind-variable.tsd-parent-kind-class.tsd-is-inherited > .tsd-kind-icon:before {
background-position: -68px -0px;
}
.tsd-kind-variable.tsd-parent-kind-class.tsd-is-protected > .tsd-kind-icon:before {
background-position: -85px -0px;
}
.tsd-kind-variable.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited > .tsd-kind-icon:before {
background-position: -102px -0px;
}
.tsd-kind-variable.tsd-parent-kind-class.tsd-is-private > .tsd-kind-icon:before {
background-position: -119px -0px;
}
.tsd-kind-variable.tsd-parent-kind-enum > .tsd-kind-icon:before {
background-position: -170px -0px;
}
.tsd-kind-variable.tsd-parent-kind-enum.tsd-is-protected > .tsd-kind-icon:before {
background-position: -187px -0px;
}
.tsd-kind-variable.tsd-parent-kind-enum.tsd-is-private > .tsd-kind-icon:before {
background-position: -119px -0px;
}
.tsd-kind-variable.tsd-parent-kind-interface > .tsd-kind-icon:before {
background-position: -204px -0px;
}
.tsd-kind-variable.tsd-parent-kind-interface.tsd-is-inherited > .tsd-kind-icon:before {
background-position: -221px -0px;
}
.tsd-kind-property > .tsd-kind-icon:before {
background-position: -136px -0px;
}
.tsd-kind-property.tsd-is-protected > .tsd-kind-icon:before {
background-position: -153px -0px;
}
.tsd-kind-property.tsd-is-private > .tsd-kind-icon:before {
background-position: -119px -0px;
}
.tsd-kind-property.tsd-parent-kind-class > .tsd-kind-icon:before {
background-position: -51px -0px;
}
.tsd-kind-property.tsd-parent-kind-class.tsd-is-inherited > .tsd-kind-icon:before {
background-position: -68px -0px;
}
.tsd-kind-property.tsd-parent-kind-class.tsd-is-protected > .tsd-kind-icon:before {
background-position: -85px -0px;
}
.tsd-kind-property.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited > .tsd-kind-icon:before {
background-position: -102px -0px;
}
.tsd-kind-property.tsd-parent-kind-class.tsd-is-private > .tsd-kind-icon:before {
background-position: -119px -0px;
}
.tsd-kind-property.tsd-parent-kind-enum > .tsd-kind-icon:before {
background-position: -170px -0px;
}
.tsd-kind-property.tsd-parent-kind-enum.tsd-is-protected > .tsd-kind-icon:before {
background-position: -187px -0px;
}
.tsd-kind-property.tsd-parent-kind-enum.tsd-is-private > .tsd-kind-icon:before {
background-position: -119px -0px;
}
.tsd-kind-property.tsd-parent-kind-interface > .tsd-kind-icon:before {
background-position: -204px -0px;
}
.tsd-kind-property.tsd-parent-kind-interface.tsd-is-inherited > .tsd-kind-icon:before {
background-position: -221px -0px;
}
.tsd-kind-get-signature > .tsd-kind-icon:before {
background-position: -136px -17px;
}
.tsd-kind-get-signature.tsd-is-protected > .tsd-kind-icon:before {
background-position: -153px -17px;
}
.tsd-kind-get-signature.tsd-is-private > .tsd-kind-icon:before {
background-position: -119px -17px;
}
.tsd-kind-get-signature.tsd-parent-kind-class > .tsd-kind-icon:before {
background-position: -51px -17px;
}
.tsd-kind-get-signature.tsd-parent-kind-class.tsd-is-inherited > .tsd-kind-icon:before {
background-position: -68px -17px;
}
.tsd-kind-get-signature.tsd-parent-kind-class.tsd-is-protected > .tsd-kind-icon:before {
background-position: -85px -17px;
}
.tsd-kind-get-signature.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited > .tsd-kind-icon:before {
background-position: -102px -17px;
}
.tsd-kind-get-signature.tsd-parent-kind-class.tsd-is-private > .tsd-kind-icon:before {
background-position: -119px -17px;
}
.tsd-kind-get-signature.tsd-parent-kind-enum > .tsd-kind-icon:before {
background-position: -170px -17px;
}
.tsd-kind-get-signature.tsd-parent-kind-enum.tsd-is-protected > .tsd-kind-icon:before {
background-position: -187px -17px;
}
.tsd-kind-get-signature.tsd-parent-kind-enum.tsd-is-private > .tsd-kind-icon:before {
background-position: -119px -17px;
}
.tsd-kind-get-signature.tsd-parent-kind-interface > .tsd-kind-icon:before {
background-position: -204px -17px;
}
.tsd-kind-get-signature.tsd-parent-kind-interface.tsd-is-inherited > .tsd-kind-icon:before {
background-position: -221px -17px;
}
.tsd-kind-set-signature > .tsd-kind-icon:before {
background-position: -136px -34px;
}
.tsd-kind-set-signature.tsd-is-protected > .tsd-kind-icon:before {
background-position: -153px -34px;
}
.tsd-kind-set-signature.tsd-is-private > .tsd-kind-icon:before {
background-position: -119px -34px;
}
.tsd-kind-set-signature.tsd-parent-kind-class > .tsd-kind-icon:before {
background-position: -51px -34px;
}
.tsd-kind-set-signature.tsd-parent-kind-class.tsd-is-inherited > .tsd-kind-icon:before {
background-position: -68px -34px;
}
.tsd-kind-set-signature.tsd-parent-kind-class.tsd-is-protected > .tsd-kind-icon:before {
background-position: -85px -34px;
}
.tsd-kind-set-signature.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited > .tsd-kind-icon:before {
background-position: -102px -34px;
}
.tsd-kind-set-signature.tsd-parent-kind-class.tsd-is-private > .tsd-kind-icon:before {
background-position: -119px -34px;
}
.tsd-kind-set-signature.tsd-parent-kind-enum > .tsd-kind-icon:before {
background-position: -170px -34px;
}
.tsd-kind-set-signature.tsd-parent-kind-enum.tsd-is-protected > .tsd-kind-icon:before {
background-position: -187px -34px;
}
.tsd-kind-set-signature.tsd-parent-kind-enum.tsd-is-private > .tsd-kind-icon:before {
background-position: -119px -34px;
}
.tsd-kind-set-signature.tsd-parent-kind-interface > .tsd-kind-icon:before {
background-position: -204px -34px;
}
.tsd-kind-set-signature.tsd-parent-kind-interface.tsd-is-inherited > .tsd-kind-icon:before {
background-position: -221px -34px;
}
.tsd-kind-accessor > .tsd-kind-icon:before {
background-position: -136px -51px;
}
.tsd-kind-accessor.tsd-is-protected > .tsd-kind-icon:before {
background-position: -153px -51px;
}
.tsd-kind-accessor.tsd-is-private > .tsd-kind-icon:before {
background-position: -119px -51px;
}
.tsd-kind-accessor.tsd-parent-kind-class > .tsd-kind-icon:before {
background-position: -51px -51px;
}
.tsd-kind-accessor.tsd-parent-kind-class.tsd-is-inherited > .tsd-kind-icon:before {
background-position: -68px -51px;
}
.tsd-kind-accessor.tsd-parent-kind-class.tsd-is-protected > .tsd-kind-icon:before {
background-position: -85px -51px;
}
.tsd-kind-accessor.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited > .tsd-kind-icon:before {
background-position: -102px -51px;
}
.tsd-kind-accessor.tsd-parent-kind-class.tsd-is-private > .tsd-kind-icon:before {
background-position: -119px -51px;
}
.tsd-kind-accessor.tsd-parent-kind-enum > .tsd-kind-icon:before {
background-position: -170px -51px;
}
.tsd-kind-accessor.tsd-parent-kind-enum.tsd-is-protected > .tsd-kind-icon:before {
background-position: -187px -51px;
}
.tsd-kind-accessor.tsd-parent-kind-enum.tsd-is-private > .tsd-kind-icon:before {
background-position: -119px -51px;
}
.tsd-kind-accessor.tsd-parent-kind-interface > .tsd-kind-icon:before {
background-position: -204px -51px;
}
.tsd-kind-accessor.tsd-parent-kind-interface.tsd-is-inherited > .tsd-kind-icon:before {
background-position: -221px -51px;
}
.tsd-kind-function > .tsd-kind-icon:before {
background-position: -136px -68px;
}
.tsd-kind-function.tsd-is-protected > .tsd-kind-icon:before {
background-position: -153px -68px;
}
.tsd-kind-function.tsd-is-private > .tsd-kind-icon:before {
background-position: -119px -68px;
}
.tsd-kind-function.tsd-parent-kind-class > .tsd-kind-icon:before {
background-position: -51px -68px;
}
.tsd-kind-function.tsd-parent-kind-class.tsd-is-inherited > .tsd-kind-icon:before {
background-position: -68px -68px;
}
.tsd-kind-function.tsd-parent-kind-class.tsd-is-protected > .tsd-kind-icon:before {
background-position: -85px -68px;
}
.tsd-kind-function.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited > .tsd-kind-icon:before {
background-position: -102px -68px;
}
.tsd-kind-function.tsd-parent-kind-class.tsd-is-private > .tsd-kind-icon:before {
background-position: -119px -68px;
}
.tsd-kind-function.tsd-parent-kind-enum > .tsd-kind-icon:before {
background-position: -170px -68px;
}
.tsd-kind-function.tsd-parent-kind-enum.tsd-is-protected > .tsd-kind-icon:before {
background-position: -187px -68px;
}
.tsd-kind-function.tsd-parent-kind-enum.tsd-is-private > .tsd-kind-icon:before {
background-position: -119px -68px;
}
.tsd-kind-function.tsd-parent-kind-interface > .tsd-kind-icon:before {
background-position: -204px -68px;
}
.tsd-kind-function.tsd-parent-kind-interface.tsd-is-inherited > .tsd-kind-icon:before {
background-position: -221px -68px;
}
.tsd-kind-method > .tsd-kind-icon:before {
background-position: -136px -68px;
}
.tsd-kind-method.tsd-is-protected > .tsd-kind-icon:before {
background-position: -153px -68px;
}
.tsd-kind-method.tsd-is-private > .tsd-kind-icon:before {
background-position: -119px -68px;
}
.tsd-kind-method.tsd-parent-kind-class > .tsd-kind-icon:before {
background-position: -51px -68px;
}
.tsd-kind-method.tsd-parent-kind-class.tsd-is-inherited > .tsd-kind-icon:before {
background-position: -68px -68px;
}
.tsd-kind-method.tsd-parent-kind-class.tsd-is-protected > .tsd-kind-icon:before {
background-position: -85px -68px;
}
.tsd-kind-method.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited > .tsd-kind-icon:before {
background-position: -102px -68px;
}
.tsd-kind-method.tsd-parent-kind-class.tsd-is-private > .tsd-kind-icon:before {
background-position: -119px -68px;
}
.tsd-kind-method.tsd-parent-kind-enum > .tsd-kind-icon:before {
background-position: -170px -68px;
}
.tsd-kind-method.tsd-parent-kind-enum.tsd-is-protected > .tsd-kind-icon:before {
background-position: -187px -68px;
}
.tsd-kind-method.tsd-parent-kind-enum.tsd-is-private > .tsd-kind-icon:before {
background-position: -119px -68px;
}
.tsd-kind-method.tsd-parent-kind-interface > .tsd-kind-icon:before {
background-position: -204px -68px;
}
.tsd-kind-method.tsd-parent-kind-interface.tsd-is-inherited > .tsd-kind-icon:before {
background-position: -221px -68px;
}
.tsd-kind-call-signature > .tsd-kind-icon:before {
background-position: -136px -68px;
}
.tsd-kind-call-signature.tsd-is-protected > .tsd-kind-icon:before {
background-position: -153px -68px;
}
.tsd-kind-call-signature.tsd-is-private > .tsd-kind-icon:before {
background-position: -119px -68px;
}
.tsd-kind-call-signature.tsd-parent-kind-class > .tsd-kind-icon:before {
background-position: -51px -68px;
}
.tsd-kind-call-signature.tsd-parent-kind-class.tsd-is-inherited > .tsd-kind-icon:before {
background-position: -68px -68px;
}
.tsd-kind-call-signature.tsd-parent-kind-class.tsd-is-protected > .tsd-kind-icon:before {
background-position: -85px -68px;
}
.tsd-kind-call-signature.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited > .tsd-kind-icon:before {
background-position: -102px -68px;
}
.tsd-kind-call-signature.tsd-parent-kind-class.tsd-is-private > .tsd-kind-icon:before {
background-position: -119px -68px;
}
.tsd-kind-call-signature.tsd-parent-kind-enum > .tsd-kind-icon:before {
background-position: -170px -68px;
}
.tsd-kind-call-signature.tsd-parent-kind-enum.tsd-is-protected > .tsd-kind-icon:before {
background-position: -187px -68px;
}
.tsd-kind-call-signature.tsd-parent-kind-enum.tsd-is-private > .tsd-kind-icon:before {
background-position: -119px -68px;
}
.tsd-kind-call-signature.tsd-parent-kind-interface > .tsd-kind-icon:before {
background-position: -204px -68px;
}
.tsd-kind-call-signature.tsd-parent-kind-interface.tsd-is-inherited > .tsd-kind-icon:before {
background-position: -221px -68px;
}
.tsd-kind-function.tsd-has-type-parameter > .tsd-kind-icon:before {
background-position: -136px -85px;
}
.tsd-kind-function.tsd-has-type-parameter.tsd-is-protected > .tsd-kind-icon:before {
background-position: -153px -85px;
}
.tsd-kind-function.tsd-has-type-parameter.tsd-is-private > .tsd-kind-icon:before {
background-position: -119px -85px;
}
.tsd-kind-function.tsd-has-type-parameter.tsd-parent-kind-class > .tsd-kind-icon:before {
background-position: -51px -85px;
}
.tsd-kind-function.tsd-has-type-parameter.tsd-parent-kind-class.tsd-is-inherited > .tsd-kind-icon:before {
background-position: -68px -85px;
}
.tsd-kind-function.tsd-has-type-parameter.tsd-parent-kind-class.tsd-is-protected > .tsd-kind-icon:before {
background-position: -85px -85px;
}
.tsd-kind-function.tsd-has-type-parameter.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited
> .tsd-kind-icon:before {
background-position: -102px -85px;
}
.tsd-kind-function.tsd-has-type-parameter.tsd-parent-kind-class.tsd-is-private > .tsd-kind-icon:before {
background-position: -119px -85px;
}
.tsd-kind-function.tsd-has-type-parameter.tsd-parent-kind-enum > .tsd-kind-icon:before {
background-position: -170px -85px;
}
.tsd-kind-function.tsd-has-type-parameter.tsd-parent-kind-enum.tsd-is-protected > .tsd-kind-icon:before {
background-position: -187px -85px;
}
.tsd-kind-function.tsd-has-type-parameter.tsd-parent-kind-enum.tsd-is-private > .tsd-kind-icon:before {
background-position: -119px -85px;
}
.tsd-kind-function.tsd-has-type-parameter.tsd-parent-kind-interface > .tsd-kind-icon:before {
background-position: -204px -85px;
}
.tsd-kind-function.tsd-has-type-parameter.tsd-parent-kind-interface.tsd-is-inherited > .tsd-kind-icon:before {
background-position: -221px -85px;
}
.tsd-kind-method.tsd-has-type-parameter > .tsd-kind-icon:before {
background-position: -136px -85px;
}
.tsd-kind-method.tsd-has-type-parameter.tsd-is-protected > .tsd-kind-icon:before {
background-position: -153px -85px;
}
.tsd-kind-method.tsd-has-type-parameter.tsd-is-private > .tsd-kind-icon:before {
background-position: -119px -85px;
}
.tsd-kind-method.tsd-has-type-parameter.tsd-parent-kind-class > .tsd-kind-icon:before {
background-position: -51px -85px;
}
.tsd-kind-method.tsd-has-type-parameter.tsd-parent-kind-class.tsd-is-inherited > .tsd-kind-icon:before {
background-position: -68px -85px;
}
.tsd-kind-method.tsd-has-type-parameter.tsd-parent-kind-class.tsd-is-protected > .tsd-kind-icon:before {
background-position: -85px -85px;
}
.tsd-kind-method.tsd-has-type-parameter.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited
> .tsd-kind-icon:before {
background-position: -102px -85px;
}
.tsd-kind-method.tsd-has-type-parameter.tsd-parent-kind-class.tsd-is-private > .tsd-kind-icon:before {
background-position: -119px -85px;
}
.tsd-kind-method.tsd-has-type-parameter.tsd-parent-kind-enum > .tsd-kind-icon:before {
background-position: -170px -85px;
}
.tsd-kind-method.tsd-has-type-parameter.tsd-parent-kind-enum.tsd-is-protected > .tsd-kind-icon:before {
background-position: -187px -85px;
}
.tsd-kind-method.tsd-has-type-parameter.tsd-parent-kind-enum.tsd-is-private > .tsd-kind-icon:before {
background-position: -119px -85px;
}
.tsd-kind-method.tsd-has-type-parameter.tsd-parent-kind-interface > .tsd-kind-icon:before {
background-position: -204px -85px;
}
.tsd-kind-method.tsd-has-type-parameter.tsd-parent-kind-interface.tsd-is-inherited > .tsd-kind-icon:before {
background-position: -221px -85px;
}
.tsd-kind-constructor > .tsd-kind-icon:before {
background-position: -136px -102px;
}
.tsd-kind-constructor.tsd-is-protected > .tsd-kind-icon:before {
background-position: -153px -102px;
}
.tsd-kind-constructor.tsd-is-private > .tsd-kind-icon:before {
background-position: -119px -102px;
}
.tsd-kind-constructor.tsd-parent-kind-class > .tsd-kind-icon:before {
background-position: -51px -102px;
}
.tsd-kind-constructor.tsd-parent-kind-class.tsd-is-inherited > .tsd-kind-icon:before {
background-position: -68px -102px;
}
.tsd-kind-constructor.tsd-parent-kind-class.tsd-is-protected > .tsd-kind-icon:before {
background-position: -85px -102px;
}
.tsd-kind-constructor.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited > .tsd-kind-icon:before {
background-position: -102px -102px;
}
.tsd-kind-constructor.tsd-parent-kind-class.tsd-is-private > .tsd-kind-icon:before {
background-position: -119px -102px;
}
.tsd-kind-constructor.tsd-parent-kind-enum > .tsd-kind-icon:before {
background-position: -170px -102px;
}
.tsd-kind-constructor.tsd-parent-kind-enum.tsd-is-protected > .tsd-kind-icon:before {
background-position: -187px -102px;
}
.tsd-kind-constructor.tsd-parent-kind-enum.tsd-is-private > .tsd-kind-icon:before {
background-position: -119px -102px;
}
.tsd-kind-constructor.tsd-parent-kind-interface > .tsd-kind-icon:before {
background-position: -204px -102px;
}
.tsd-kind-constructor.tsd-parent-kind-interface.tsd-is-inherited > .tsd-kind-icon:before {
background-position: -221px -102px;
}
.tsd-kind-constructor-signature > .tsd-kind-icon:before {
background-position: -136px -102px;
}
.tsd-kind-constructor-signature.tsd-is-protected > .tsd-kind-icon:before {
background-position: -153px -102px;
}
.tsd-kind-constructor-signature.tsd-is-private > .tsd-kind-icon:before {
background-position: -119px -102px;
}
.tsd-kind-constructor-signature.tsd-parent-kind-class > .tsd-kind-icon:before {
background-position: -51px -102px;
}
.tsd-kind-constructor-signature.tsd-parent-kind-class.tsd-is-inherited > .tsd-kind-icon:before {
background-position: -68px -102px;
}
.tsd-kind-constructor-signature.tsd-parent-kind-class.tsd-is-protected > .tsd-kind-icon:before {
background-position: -85px -102px;
}
.tsd-kind-constructor-signature.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited > .tsd-kind-icon:before {
background-position: -102px -102px;
}
.tsd-kind-constructor-signature.tsd-parent-kind-class.tsd-is-private > .tsd-kind-icon:before {
background-position: -119px -102px;
}
.tsd-kind-constructor-signature.tsd-parent-kind-enum > .tsd-kind-icon:before {
background-position: -170px -102px;
}
.tsd-kind-constructor-signature.tsd-parent-kind-enum.tsd-is-protected > .tsd-kind-icon:before {
background-position: -187px -102px;
}
.tsd-kind-constructor-signature.tsd-parent-kind-enum.tsd-is-private > .tsd-kind-icon:before {
background-position: -119px -102px;
}
.tsd-kind-constructor-signature.tsd-parent-kind-interface > .tsd-kind-icon:before {
background-position: -204px -102px;
}
.tsd-kind-constructor-signature.tsd-parent-kind-interface.tsd-is-inherited > .tsd-kind-icon:before {
background-position: -221px -102px;
}
.tsd-kind-index-signature > .tsd-kind-icon:before {
background-position: -136px -119px;
}
.tsd-kind-index-signature.tsd-is-protected > .tsd-kind-icon:before {
background-position: -153px -119px;
}
.tsd-kind-index-signature.tsd-is-private > .tsd-kind-icon:before {
background-position: -119px -119px;
}
.tsd-kind-index-signature.tsd-parent-kind-class > .tsd-kind-icon:before {
background-position: -51px -119px;
}
.tsd-kind-index-signature.tsd-parent-kind-class.tsd-is-inherited > .tsd-kind-icon:before {
background-position: -68px -119px;
}
.tsd-kind-index-signature.tsd-parent-kind-class.tsd-is-protected > .tsd-kind-icon:before {
background-position: -85px -119px;
}
.tsd-kind-index-signature.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited > .tsd-kind-icon:before {
background-position: -102px -119px;
}
.tsd-kind-index-signature.tsd-parent-kind-class.tsd-is-private > .tsd-kind-icon:before {
background-position: -119px -119px;
}
.tsd-kind-index-signature.tsd-parent-kind-enum > .tsd-kind-icon:before {
background-position: -170px -119px;
}
.tsd-kind-index-signature.tsd-parent-kind-enum.tsd-is-protected > .tsd-kind-icon:before {
background-position: -187px -119px;
}
.tsd-kind-index-signature.tsd-parent-kind-enum.tsd-is-private > .tsd-kind-icon:before {
background-position: -119px -119px;
}
.tsd-kind-index-signature.tsd-parent-kind-interface > .tsd-kind-icon:before {
background-position: -204px -119px;
}
.tsd-kind-index-signature.tsd-parent-kind-interface.tsd-is-inherited > .tsd-kind-icon:before {
background-position: -221px -119px;
}
.tsd-kind-event > .tsd-kind-icon:before {
background-position: -136px -136px;
}
.tsd-kind-event.tsd-is-protected > .tsd-kind-icon:before {
background-position: -153px -136px;
}
.tsd-kind-event.tsd-is-private > .tsd-kind-icon:before {
background-position: -119px -136px;
}
.tsd-kind-event.tsd-parent-kind-class > .tsd-kind-icon:before {
background-position: -51px -136px;
}
.tsd-kind-event.tsd-parent-kind-class.tsd-is-inherited > .tsd-kind-icon:before {
background-position: -68px -136px;
}
.tsd-kind-event.tsd-parent-kind-class.tsd-is-protected > .tsd-kind-icon:before {
background-position: -85px -136px;
}
.tsd-kind-event.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited > .tsd-kind-icon:before {
background-position: -102px -136px;
}
.tsd-kind-event.tsd-parent-kind-class.tsd-is-private > .tsd-kind-icon:before {
background-position: -119px -136px;
}
.tsd-kind-event.tsd-parent-kind-enum > .tsd-kind-icon:before {
background-position: -170px -136px;
}
.tsd-kind-event.tsd-parent-kind-enum.tsd-is-protected > .tsd-kind-icon:before {
background-position: -187px -136px;
}
.tsd-kind-event.tsd-parent-kind-enum.tsd-is-private > .tsd-kind-icon:before {
background-position: -119px -136px;
}
.tsd-kind-event.tsd-parent-kind-interface > .tsd-kind-icon:before {
background-position: -204px -136px;
}
.tsd-kind-event.tsd-parent-kind-interface.tsd-is-inherited > .tsd-kind-icon:before {
background-position: -221px -136px;
}
.tsd-is-static > .tsd-kind-icon:before {
background-position: -136px -153px;
}
.tsd-is-static.tsd-is-protected > .tsd-kind-icon:before {
background-position: -153px -153px;
}
.tsd-is-static.tsd-is-private > .tsd-kind-icon:before {
background-position: -119px -153px;
}
.tsd-is-static.tsd-parent-kind-class > .tsd-kind-icon:before {
background-position: -51px -153px;
}
.tsd-is-static.tsd-parent-kind-class.tsd-is-inherited > .tsd-kind-icon:before {
background-position: -68px -153px;
}
.tsd-is-static.tsd-parent-kind-class.tsd-is-protected > .tsd-kind-icon:before {
background-position: -85px -153px;
}
.tsd-is-static.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited > .tsd-kind-icon:before {
background-position: -102px -153px;
}
.tsd-is-static.tsd-parent-kind-class.tsd-is-private > .tsd-kind-icon:before {
background-position: -119px -153px;
}
.tsd-is-static.tsd-parent-kind-enum > .tsd-kind-icon:before {
background-position: -170px -153px;
}
.tsd-is-static.tsd-parent-kind-enum.tsd-is-protected > .tsd-kind-icon:before {
background-position: -187px -153px;
}
.tsd-is-static.tsd-parent-kind-enum.tsd-is-private > .tsd-kind-icon:before {
background-position: -119px -153px;
}
.tsd-is-static.tsd-parent-kind-interface > .tsd-kind-icon:before {
background-position: -204px -153px;
}
.tsd-is-static.tsd-parent-kind-interface.tsd-is-inherited > .tsd-kind-icon:before {
background-position: -221px -153px;
}
.tsd-is-static.tsd-kind-function > .tsd-kind-icon:before {
background-position: -136px -170px;
}
.tsd-is-static.tsd-kind-function.tsd-is-protected > .tsd-kind-icon:before {
background-position: -153px -170px;
}
.tsd-is-static.tsd-kind-function.tsd-is-private > .tsd-kind-icon:before {
background-position: -119px -170px;
}
.tsd-is-static.tsd-kind-function.tsd-parent-kind-class > .tsd-kind-icon:before {
background-position: -51px -170px;
}
.tsd-is-static.tsd-kind-function.tsd-parent-kind-class.tsd-is-inherited > .tsd-kind-icon:before {
background-position: -68px -170px;
}
.tsd-is-static.tsd-kind-function.tsd-parent-kind-class.tsd-is-protected > .tsd-kind-icon:before {
background-position: -85px -170px;
}
.tsd-is-static.tsd-kind-function.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited > .tsd-kind-icon:before {
background-position: -102px -170px;
}
.tsd-is-static.tsd-kind-function.tsd-parent-kind-class.tsd-is-private > .tsd-kind-icon:before {
background-position: -119px -170px;
}
.tsd-is-static.tsd-kind-function.tsd-parent-kind-enum > .tsd-kind-icon:before {
background-position: -170px -170px;
}
.tsd-is-static.tsd-kind-function.tsd-parent-kind-enum.tsd-is-protected > .tsd-kind-icon:before {
background-position: -187px -170px;
}
.tsd-is-static.tsd-kind-function.tsd-parent-kind-enum.tsd-is-private > .tsd-kind-icon:before {
background-position: -119px -170px;
}
.tsd-is-static.tsd-kind-function.tsd-parent-kind-interface > .tsd-kind-icon:before {
background-position: -204px -170px;
}
.tsd-is-static.tsd-kind-function.tsd-parent-kind-interface.tsd-is-inherited > .tsd-kind-icon:before {
background-position: -221px -170px;
}
.tsd-is-static.tsd-kind-method > .tsd-kind-icon:before {
background-position: -136px -170px;
}
.tsd-is-static.tsd-kind-method.tsd-is-protected > .tsd-kind-icon:before {
background-position: -153px -170px;
}
.tsd-is-static.tsd-kind-method.tsd-is-private > .tsd-kind-icon:before {
background-position: -119px -170px;
}
.tsd-is-static.tsd-kind-method.tsd-parent-kind-class > .tsd-kind-icon:before {
background-position: -51px -170px;
}
.tsd-is-static.tsd-kind-method.tsd-parent-kind-class.tsd-is-inherited > .tsd-kind-icon:before {
background-position: -68px -170px;
}
.tsd-is-static.tsd-kind-method.tsd-parent-kind-class.tsd-is-protected > .tsd-kind-icon:before {
background-position: -85px -170px;
}
.tsd-is-static.tsd-kind-method.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited > .tsd-kind-icon:before {
background-position: -102px -170px;
}
.tsd-is-static.tsd-kind-method.tsd-parent-kind-class.tsd-is-private > .tsd-kind-icon:before {
background-position: -119px -170px;
}
.tsd-is-static.tsd-kind-method.tsd-parent-kind-enum > .tsd-kind-icon:before {
background-position: -170px -170px;
}
.tsd-is-static.tsd-kind-method.tsd-parent-kind-enum.tsd-is-protected > .tsd-kind-icon:before {
background-position: -187px -170px;
}
.tsd-is-static.tsd-kind-method.tsd-parent-kind-enum.tsd-is-private > .tsd-kind-icon:before {
background-position: -119px -170px;
}
.tsd-is-static.tsd-kind-method.tsd-parent-kind-interface > .tsd-kind-icon:before {
background-position: -204px -170px;
}
.tsd-is-static.tsd-kind-method.tsd-parent-kind-interface.tsd-is-inherited > .tsd-kind-icon:before {
background-position: -221px -170px;
}
.tsd-is-static.tsd-kind-call-signature > .tsd-kind-icon:before {
background-position: -136px -170px;
}
.tsd-is-static.tsd-kind-call-signature.tsd-is-protected > .tsd-kind-icon:before {
background-position: -153px -170px;
}
.tsd-is-static.tsd-kind-call-signature.tsd-is-private > .tsd-kind-icon:before {
background-position: -119px -170px;
}
.tsd-is-static.tsd-kind-call-signature.tsd-parent-kind-class > .tsd-kind-icon:before {
background-position: -51px -170px;
}
.tsd-is-static.tsd-kind-call-signature.tsd-parent-kind-class.tsd-is-inherited > .tsd-kind-icon:before {
background-position: -68px -170px;
}
.tsd-is-static.tsd-kind-call-signature.tsd-parent-kind-class.tsd-is-protected > .tsd-kind-icon:before {
background-position: -85px -170px;
}
.tsd-is-static.tsd-kind-call-signature.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited > .tsd-kind-icon:before {
background-position: -102px -170px;
}
.tsd-is-static.tsd-kind-call-signature.tsd-parent-kind-class.tsd-is-private > .tsd-kind-icon:before {
background-position: -119px -170px;
}
.tsd-is-static.tsd-kind-call-signature.tsd-parent-kind-enum > .tsd-kind-icon:before {
background-position: -170px -170px;
}
.tsd-is-static.tsd-kind-call-signature.tsd-parent-kind-enum.tsd-is-protected > .tsd-kind-icon:before {
background-position: -187px -170px;
}
.tsd-is-static.tsd-kind-call-signature.tsd-parent-kind-enum.tsd-is-private > .tsd-kind-icon:before {
background-position: -119px -170px;
}
.tsd-is-static.tsd-kind-call-signature.tsd-parent-kind-interface > .tsd-kind-icon:before {
background-position: -204px -170px;
}
.tsd-is-static.tsd-kind-call-signature.tsd-parent-kind-interface.tsd-is-inherited > .tsd-kind-icon:before {
background-position: -221px -170px;
}
.tsd-is-static.tsd-kind-event > .tsd-kind-icon:before {
background-position: -136px -187px;
}
.tsd-is-static.tsd-kind-event.tsd-is-protected > .tsd-kind-icon:before {
background-position: -153px -187px;
}
.tsd-is-static.tsd-kind-event.tsd-is-private > .tsd-kind-icon:before {
background-position: -119px -187px;
}
.tsd-is-static.tsd-kind-event.tsd-parent-kind-class > .tsd-kind-icon:before {
background-position: -51px -187px;
}
.tsd-is-static.tsd-kind-event.tsd-parent-kind-class.tsd-is-inherited > .tsd-kind-icon:before {
background-position: -68px -187px;
}
.tsd-is-static.tsd-kind-event.tsd-parent-kind-class.tsd-is-protected > .tsd-kind-icon:before {
background-position: -85px -187px;
}
.tsd-is-static.tsd-kind-event.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited > .tsd-kind-icon:before {
background-position: -102px -187px;
}
.tsd-is-static.tsd-kind-event.tsd-parent-kind-class.tsd-is-private > .tsd-kind-icon:before {
background-position: -119px -187px;
}
.tsd-is-static.tsd-kind-event.tsd-parent-kind-enum > .tsd-kind-icon:before {
background-position: -170px -187px;
}
.tsd-is-static.tsd-kind-event.tsd-parent-kind-enum.tsd-is-protected > .tsd-kind-icon:before {
background-position: -187px -187px;
}
.tsd-is-static.tsd-kind-event.tsd-parent-kind-enum.tsd-is-private > .tsd-kind-icon:before {
background-position: -119px -187px;
}
.tsd-is-static.tsd-kind-event.tsd-parent-kind-interface > .tsd-kind-icon:before {
background-position: -204px -187px;
}
.tsd-is-static.tsd-kind-event.tsd-parent-kind-interface.tsd-is-inherited > .tsd-kind-icon:before {
background-position: -221px -187px;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 480 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 855 B

View File

@@ -1,992 +0,0 @@
<!DOCTYPE html>
<html class="default">
<head>
<meta charset="utf-8" />
<meta http-equiv="x-ua-compatible" content="IE=edge" />
<title>Handler - SernHandler</title>
<meta name="description" content="Documentation for sern-handler" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="../assets/style.css" />
<link rel="stylesheet" href="../assets/highlight.css" />
<script async src="../assets/search.js" id="search-script"></script>
</head>
<body>
<script>
document.body.classList.add(localStorage.getItem('tsd-theme') || 'os');
</script>
<header>
<div class="tsd-page-toolbar">
<div class="container">
<div class="table-wrap">
<div class="table-cell" id="tsd-search" data-base="..">
<div class="field">
<label for="tsd-search-field" class="tsd-widget search no-caption">Search</label
><input type="text" id="tsd-search-field" />
</div>
<ul class="results">
<li class="state loading">Preparing search index...</li>
<li class="state failure">The search index is not available</li>
</ul>
<a href="../index.html" class="title">sern-handler</a>
</div>
<div class="table-cell" id="tsd-widgets">
<div id="tsd-filter">
<a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a>
<div class="tsd-filter-group">
<div class="tsd-select" id="tsd-filter-visibility">
<span class="tsd-select-label">All</span>
<ul class="tsd-select-list">
<li data-value="public">Public</li>
<li data-value="protected">Public/Protected</li>
<li data-value="private" class="selected">All</li>
</ul>
</div>
<input type="checkbox" id="tsd-filter-inherited" checked /><label
class="tsd-widget"
for="tsd-filter-inherited"
>Inherited</label
><input type="checkbox" id="tsd-filter-externals" checked /><label
class="tsd-widget"
for="tsd-filter-externals"
>Externals</label
>
</div>
</div>
<a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a>
</div>
</div>
</div>
</div>
<div class="tsd-page-title">
<div class="container">
<ul class="tsd-breadcrumb">
<li><a href="../modules.html">sern-handler</a></li>
<li><a href="../modules/Sern.html">Sern</a></li>
<li><a href="Sern.Handler.html">Handler</a></li>
</ul>
<h1>Class Handler</h1>
</div>
</div>
</header>
<div class="container container-main">
<div class="row">
<div class="col-8 col-content">
<section class="tsd-panel tsd-hierarchy">
<h3>Hierarchy</h3>
<ul class="tsd-hierarchy">
<li><span class="target">Handler</span></li>
</ul>
</section>
<section class="tsd-panel-group tsd-index-group">
<h2>Index</h2>
<section class="tsd-panel tsd-index-panel">
<div class="tsd-index-content">
<section class="tsd-index-section">
<h3>Constructors</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-constructor tsd-parent-kind-class">
<a href="Sern.Handler.html#constructor" class="tsd-kind-icon">constructor</a>
</li>
</ul>
</section>
<section class="tsd-index-section tsd-is-private tsd-is-private-protected">
<h3>Properties</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-private">
<a href="Sern.Handler.html#wrapper" class="tsd-kind-icon">wrapper</a>
</li>
</ul>
</section>
<section class="tsd-index-section">
<h3>Accessors</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-get-signature tsd-parent-kind-class">
<a href="Sern.Handler.html#client" class="tsd-kind-icon">client</a>
</li>
<li class="tsd-kind-get-signature tsd-parent-kind-class">
<a href="Sern.Handler.html#commandDir" class="tsd-kind-icon">command<wbr />Dir</a>
</li>
<li class="tsd-kind-get-signature tsd-parent-kind-class">
<a href="Sern.Handler.html#prefix" class="tsd-kind-icon">prefix</a>
</li>
<li class="tsd-kind-get-signature tsd-parent-kind-class">
<a href="Sern.Handler.html#privateServers" class="tsd-kind-icon">private<wbr />Servers</a>
</li>
</ul>
</section>
<section class="tsd-index-section tsd-is-private tsd-is-private-protected">
<h3>Methods</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-private">
<a href="Sern.Handler.html#commandResult" class="tsd-kind-icon">command<wbr />Result</a>
</li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-private">
<a href="Sern.Handler.html#findModuleFrom" class="tsd-kind-icon">find<wbr />Module<wbr />From</a>
</li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-private">
<a href="Sern.Handler.html#interactionResult" class="tsd-kind-icon">interaction<wbr />Result</a>
</li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-private">
<a href="Sern.Handler.html#registerModules" class="tsd-kind-icon">register<wbr />Modules</a>
</li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-private">
<a href="Sern.Handler.html#reloadSlash" class="tsd-kind-icon">reload<wbr />Slash</a>
</li>
</ul>
</section>
</div>
</section>
</section>
<section class="tsd-panel-group tsd-member-group">
<h2>Constructors</h2>
<section class="tsd-panel tsd-member tsd-kind-constructor tsd-parent-kind-class">
<a id="constructor" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link">
constructor<a href="#constructor" aria-label="Permalink" class="tsd-anchor-icon"
><svg
xmlns="http://www.w3.org/2000/svg"
class="icon icon-tabler icon-tabler-link"
viewBox="0 0 24 24"
stroke-width="2"
stroke="currentColor"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
>
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path>
<path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg
></a>
</h3>
<ul class="tsd-signatures tsd-kind-constructor tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">
new <wbr />Handler<span class="tsd-signature-symbol">(</span>wrapper<span class="tsd-signature-symbol"
>: </span
><a href="../interfaces/Sern.Wrapper.html" class="tsd-signature-type" data-tsd-kind="Interface"
>Wrapper</a
><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span
><a href="Sern.Handler.html" class="tsd-signature-type" data-tsd-kind="Class">Handler</a>
</li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>
Defined in
<a href="https://github.com/sern-handler/Sern/blob/29d92ca/src/handler/sern.ts#L36"
>handler/sern.ts:36</a
>
</li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>
wrapper:
<a href="../interfaces/Sern.Wrapper.html" class="tsd-signature-type" data-tsd-kind="Interface"
>Wrapper</a
>
</h5>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>The data that is required to run sern handler</p>
</div>
</div>
</li>
</ul>
<h4 class="tsd-returns-title">
Returns <a href="Sern.Handler.html" class="tsd-signature-type" data-tsd-kind="Class">Handler</a>
</h4>
</li>
</ul>
</section>
</section>
<section class="tsd-panel-group tsd-member-group tsd-is-private tsd-is-private-protected">
<h2>Properties</h2>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-private">
<a id="wrapper" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link">
<span class="tsd-flag ts-flagPrivate">Private</span> wrapper<a
href="#wrapper"
aria-label="Permalink"
class="tsd-anchor-icon"
><svg
xmlns="http://www.w3.org/2000/svg"
class="icon icon-tabler icon-tabler-link"
viewBox="0 0 24 24"
stroke-width="2"
stroke="currentColor"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
>
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path>
<path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg
></a>
</h3>
<div class="tsd-signature tsd-kind-icon">
wrapper<span class="tsd-signature-symbol">:</span>
<a href="../interfaces/Sern.Wrapper.html" class="tsd-signature-type" data-tsd-kind="Interface"
>Wrapper</a
>
</div>
<aside class="tsd-sources">
<ul>
<li>
Defined in
<a href="https://github.com/sern-handler/Sern/blob/29d92ca/src/handler/sern.ts#L28"
>handler/sern.ts:28</a
>
</li>
</ul>
</aside>
</section>
</section>
<section class="tsd-panel-group tsd-member-group">
<h2>Accessors</h2>
<section class="tsd-panel tsd-member tsd-kind-get-signature tsd-parent-kind-class">
<a id="client" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link">
client<a href="#client" aria-label="Permalink" class="tsd-anchor-icon"
><svg
xmlns="http://www.w3.org/2000/svg"
class="icon icon-tabler icon-tabler-link"
viewBox="0 0 24 24"
stroke-width="2"
stroke="currentColor"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
>
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path>
<path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg
></a>
</h3>
<ul class="tsd-signatures tsd-kind-get-signature tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">
<span class="tsd-signature-symbol">get</span> client<span class="tsd-signature-symbol">(</span
><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span
><span class="tsd-signature-type">Client</span><span class="tsd-signature-symbol">&lt;</span
><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">&gt;</span>
</li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>
Defined in
<a href="https://github.com/sern-handler/Sern/blob/29d92ca/src/handler/sern.ts#L246"
>handler/sern.ts:246</a
>
</li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<dl class="tsd-comment-tags">
<dt>readonly</dt>
<dd></dd>
</dl>
</div>
<h4 class="tsd-returns-title">
Returns <span class="tsd-signature-type">Client</span><span class="tsd-signature-symbol">&lt;</span
><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">&gt;</span>
</h4>
<div><p>the discord.js client (DiscordJS#Client));</p></div>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-get-signature tsd-parent-kind-class">
<a id="commandDir" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link">
command<wbr />Dir<a href="#commandDir" aria-label="Permalink" class="tsd-anchor-icon"
><svg
xmlns="http://www.w3.org/2000/svg"
class="icon icon-tabler icon-tabler-link"
viewBox="0 0 24 24"
stroke-width="2"
stroke="currentColor"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
>
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path>
<path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg
></a>
</h3>
<ul class="tsd-signatures tsd-kind-get-signature tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">
<span class="tsd-signature-symbol">get</span> commandDir<span class="tsd-signature-symbol">(</span
><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span
><span class="tsd-signature-type">string</span>
</li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>
Defined in
<a href="https://github.com/sern-handler/Sern/blob/29d92ca/src/handler/sern.ts#L237"
>handler/sern.ts:237</a
>
</li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<dl class="tsd-comment-tags">
<dt>readonly</dt>
<dd></dd>
</dl>
</div>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4>
<div><p>Directory of the commands folder</p></div>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-get-signature tsd-parent-kind-class">
<a id="prefix" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link">
prefix<a href="#prefix" aria-label="Permalink" class="tsd-anchor-icon"
><svg
xmlns="http://www.w3.org/2000/svg"
class="icon icon-tabler icon-tabler-link"
viewBox="0 0 24 24"
stroke-width="2"
stroke="currentColor"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
>
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path>
<path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg
></a>
</h3>
<ul class="tsd-signatures tsd-kind-get-signature tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">
<span class="tsd-signature-symbol">get</span> prefix<span class="tsd-signature-symbol">(</span
><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span
><span class="tsd-signature-type">string</span>
</li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>
Defined in
<a href="https://github.com/sern-handler/Sern/blob/29d92ca/src/handler/sern.ts#L228"
>handler/sern.ts:228</a
>
</li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<dl class="tsd-comment-tags">
<dt>readonly</dt>
<dd></dd>
</dl>
</div>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4>
<div><p>The prefix used for legacy commands</p></div>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-get-signature tsd-parent-kind-class">
<a id="privateServers" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link">
private<wbr />Servers<a href="#privateServers" aria-label="Permalink" class="tsd-anchor-icon"
><svg
xmlns="http://www.w3.org/2000/svg"
class="icon icon-tabler icon-tabler-link"
viewBox="0 0 24 24"
stroke-width="2"
stroke="currentColor"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
>
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path>
<path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg
></a>
</h3>
<ul class="tsd-signatures tsd-kind-get-signature tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">
<span class="tsd-signature-symbol">get</span> privateServers<span class="tsd-signature-symbol">(</span
><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span
><span class="tsd-signature-symbol">{ </span>id<span class="tsd-signature-symbol">: </span
><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>test<span
class="tsd-signature-symbol"
>: </span
><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> }</span
><span class="tsd-signature-symbol">[]</span>
</li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>
Defined in
<a href="https://github.com/sern-handler/Sern/blob/29d92ca/src/handler/sern.ts#L255"
>handler/sern.ts:255</a
>
</li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<dl class="tsd-comment-tags">
<dt>readonly</dt>
<dd></dd>
</dl>
</div>
<h4 class="tsd-returns-title">
Returns <span class="tsd-signature-symbol">{ </span>id<span class="tsd-signature-symbol">: </span
><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>test<span
class="tsd-signature-symbol"
>: </span
><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> }</span
><span class="tsd-signature-symbol">[]</span>
</h4>
<div><p>[]} Private server ID for testing or personal use</p></div>
</li>
</ul>
</section>
</section>
<section class="tsd-panel-group tsd-member-group tsd-is-private tsd-is-private-protected">
<h2>Methods</h2>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-private">
<a id="commandResult" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link">
<span class="tsd-flag ts-flagPrivate">Private</span> command<wbr />Result<a
href="#commandResult"
aria-label="Permalink"
class="tsd-anchor-icon"
><svg
xmlns="http://www.w3.org/2000/svg"
class="icon icon-tabler icon-tabler-link"
viewBox="0 0 24 24"
stroke-width="2"
stroke="currentColor"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
>
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path>
<path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg
></a>
</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-private">
<li class="tsd-signature tsd-kind-icon">
command<wbr />Result<span class="tsd-signature-symbol">(</span>module<span
class="tsd-signature-symbol"
>: </span
><span class="tsd-signature-type">CommandVal</span>, message<span class="tsd-signature-symbol"
>: </span
><span class="tsd-signature-type">Message</span><span class="tsd-signature-symbol">&lt;</span
><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">&gt;</span
><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span
><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span
><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span
><a href="../modules/Types.html#possibleOutput" class="tsd-signature-type" data-tsd-kind="Type alias"
>possibleOutput</a
><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">string</span
><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">&gt;</span>
</li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>
Defined in
<a href="https://github.com/sern-handler/Sern/blob/29d92ca/src/handler/sern.ts#L112"
>handler/sern.ts:112</a
>
</li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>module: <span class="tsd-signature-type">CommandVal</span></h5>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Command file information</p>
</div>
</div>
</li>
<li>
<h5>
message: <span class="tsd-signature-type">Message</span
><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">boolean</span
><span class="tsd-signature-symbol">&gt;</span>
</h5>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>The message object</p>
</div>
</div>
</li>
</ul>
<h4 class="tsd-returns-title">
Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span
><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span
><a
href="../modules/Types.html#possibleOutput"
class="tsd-signature-type"
data-tsd-kind="Type alias"
>possibleOutput</a
><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">string</span
><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">&gt;</span>
</h4>
<div><p>Takes return value and replies it, if possible input</p></div>
</li>
</ul>
</section>
<section
class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-private"
>
<a id="findModuleFrom" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link">
<span class="tsd-flag ts-flagPrivate">Private</span> find<wbr />Module<wbr />From<a
href="#findModuleFrom"
aria-label="Permalink"
class="tsd-anchor-icon"
><svg
xmlns="http://www.w3.org/2000/svg"
class="icon icon-tabler icon-tabler-link"
viewBox="0 0 24 24"
stroke-width="2"
stroke="currentColor"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
>
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path>
<path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg
></a>
</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-private">
<li class="tsd-signature tsd-kind-icon">
find<wbr />Module<wbr />From<span class="tsd-signature-symbol">&lt;</span
><span class="tsd-signature-type" data-tsd-kind="Type parameter">T</span
><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">(</span>ctx<span
class="tsd-signature-symbol"
>: </span
><span class="tsd-signature-type" data-tsd-kind="Type parameter">T</span
><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span
><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span
><span class="tsd-signature-type">CommandVal</span>
</li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>
Defined in
<a href="https://github.com/sern-handler/Sern/blob/29d92ca/src/handler/sern.ts#L194"
>handler/sern.ts:194</a
>
</li>
</ul>
</aside>
<h4 class="tsd-type-parameters-title">Type parameters</h4>
<ul class="tsd-type-parameters">
<li>
<h4>
T<span class="tsd-signature-symbol">: </span
><span class="tsd-signature-type">CommandInteraction</span
><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">CacheType</span
><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol"> | </span
><span class="tsd-signature-type">Message</span><span class="tsd-signature-symbol">&lt;</span
><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">&gt;</span>
</h4>
</li>
</ul>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>ctx: <span class="tsd-signature-type" data-tsd-kind="Type parameter">T</span></h5>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>name of possible command</p>
</div>
</div>
</li>
</ul>
<h4 class="tsd-returns-title">
Returns <span class="tsd-signature-type">undefined</span
><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">CommandVal</span>
</h4>
<div></div>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-private">
<a id="interactionResult" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link">
<span class="tsd-flag ts-flagPrivate">Private</span> interaction<wbr />Result<a
href="#interactionResult"
aria-label="Permalink"
class="tsd-anchor-icon"
><svg
xmlns="http://www.w3.org/2000/svg"
class="icon icon-tabler icon-tabler-link"
viewBox="0 0 24 24"
stroke-width="2"
stroke="currentColor"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
>
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path>
<path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg
></a>
</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-private">
<li class="tsd-signature tsd-kind-icon">
interaction<wbr />Result<span class="tsd-signature-symbol">(</span>module<span
class="tsd-signature-symbol"
>: </span
><span class="tsd-signature-type">CommandVal</span>, interaction<span class="tsd-signature-symbol"
>: </span
><span class="tsd-signature-type">CommandInteraction</span
><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">CacheType</span
><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">)</span
><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span
><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">undefined</span
><span class="tsd-signature-symbol"> | </span
><a href="../modules/Types.html#possibleOutput" class="tsd-signature-type" data-tsd-kind="Type alias"
>possibleOutput</a
><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">string</span
><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">&gt;</span>
</li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>
Defined in
<a href="https://github.com/sern-handler/Sern/blob/29d92ca/src/handler/sern.ts#L88"
>handler/sern.ts:88</a
>
</li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>module: <span class="tsd-signature-type">CommandVal</span></h5>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Command file information</p>
</div>
</div>
</li>
<li>
<h5>
interaction: <span class="tsd-signature-type">CommandInteraction</span
><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">CacheType</span
><span class="tsd-signature-symbol">&gt;</span>
</h5>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>The Discord.js command interaction (DiscordJS#CommandInteraction))</p>
</div>
</div>
</li>
</ul>
<h4 class="tsd-returns-title">
Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span
><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span
><a
href="../modules/Types.html#possibleOutput"
class="tsd-signature-type"
data-tsd-kind="Type alias"
>possibleOutput</a
><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">string</span
><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">&gt;</span>
</h4>
<div><p>Takes return value and replies it, if possible input</p></div>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-private">
<a id="registerModules" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link">
<span class="tsd-flag ts-flagPrivate">Private</span> register<wbr />Modules<a
href="#registerModules"
aria-label="Permalink"
class="tsd-anchor-icon"
><svg
xmlns="http://www.w3.org/2000/svg"
class="icon icon-tabler icon-tabler-link"
viewBox="0 0 24 24"
stroke-width="2"
stroke="currentColor"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
>
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path>
<path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg
></a>
</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-private">
<li class="tsd-signature tsd-kind-icon">
register<wbr />Modules<span class="tsd-signature-symbol">(</span>modArr<span
class="tsd-signature-symbol"
>: </span
><span class="tsd-signature-symbol">{ </span>absPath<span class="tsd-signature-symbol">: </span
><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>mod<span
class="tsd-signature-symbol"
>: </span
><a href="../interfaces/Sern.Module.html" class="tsd-signature-type" data-tsd-kind="Interface"
>Module</a
><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">unknown</span
><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">; </span>name<span
class="tsd-signature-symbol"
>: </span
><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> }</span
><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span
><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span
><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span
><span class="tsd-signature-symbol">&gt;</span>
</li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>
Defined in
<a href="https://github.com/sern-handler/Sern/blob/29d92ca/src/handler/sern.ts#L142"
>handler/sern.ts:142</a
>
</li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>This function chains <code>Files.buildData</code></p>
</div>
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>
modArr: <span class="tsd-signature-symbol">{ </span>absPath<span class="tsd-signature-symbol"
>: </span
><span class="tsd-signature-type">string</span
><span class="tsd-signature-symbol">; </span>mod<span class="tsd-signature-symbol">: </span
><a href="../interfaces/Sern.Module.html" class="tsd-signature-type" data-tsd-kind="Interface"
>Module</a
><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">unknown</span
><span class="tsd-signature-symbol">&gt;</span
><span class="tsd-signature-symbol">; </span>name<span class="tsd-signature-symbol">: </span
><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> }</span
><span class="tsd-signature-symbol">[]</span>
</h5>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>module information</p>
</div>
</div>
</li>
</ul>
<h4 class="tsd-returns-title">
Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span
><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span>
</h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-private">
<a id="reloadSlash" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link">
<span class="tsd-flag ts-flagPrivate">Private</span> reload<wbr />Slash<a
href="#reloadSlash"
aria-label="Permalink"
class="tsd-anchor-icon"
><svg
xmlns="http://www.w3.org/2000/svg"
class="icon icon-tabler icon-tabler-link"
viewBox="0 0 24 24"
stroke-width="2"
stroke="currentColor"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
>
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path>
<path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg
></a>
</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-private">
<li class="tsd-signature tsd-kind-icon">
reload<wbr />Slash<span class="tsd-signature-symbol">(</span>cmdName<span class="tsd-signature-symbol"
>: </span
><span class="tsd-signature-type">string</span>, description<span class="tsd-signature-symbol"
>: </span
><span class="tsd-signature-type">string</span>, options<span class="tsd-signature-symbol">: </span
><span class="tsd-signature-type">ApplicationCommandOptionData</span
><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span
><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span
><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span
><span class="tsd-signature-symbol">&gt;</span>
</li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>
Defined in
<a href="https://github.com/sern-handler/Sern/blob/29d92ca/src/handler/sern.ts#L207"
>handler/sern.ts:207</a
>
</li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>cmdName: <span class="tsd-signature-type">string</span></h5>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>name of command</p>
</div>
</div>
</li>
<li>
<h5>description: <span class="tsd-signature-type">string</span></h5>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>description of command</p>
</div>
</div>
</li>
<li>
<h5>
options: <span class="tsd-signature-type">ApplicationCommandOptionData</span
><span class="tsd-signature-symbol">[]</span>
</h5>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>any options for the slash command</p>
</div>
</div>
</li>
</ul>
<h4 class="tsd-returns-title">
Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span
><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span>
</h4>
</li>
</ul>
</section>
</section>
</div>
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
<nav class="tsd-navigation primary">
<ul>
<li class=""><a href="../modules.html">Exports</a></li>
<li class="current tsd-kind-namespace"><a href="../modules/Sern.html">Sern</a></li>
<li class="tsd-kind-namespace"><a href="../modules/Types.html">Types</a></li>
<li class="tsd-kind-namespace"><a href="../modules/Utils.html">Utils</a></li>
</ul>
</nav>
<nav class="tsd-navigation secondary menu-sticky">
<ul>
<li class="current tsd-kind-class tsd-parent-kind-namespace">
<a href="Sern.Handler.html" class="tsd-kind-icon">Handler</a>
<ul>
<li class="tsd-kind-constructor tsd-parent-kind-class">
<a href="Sern.Handler.html#constructor" class="tsd-kind-icon">constructor</a>
</li>
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-private">
<a href="Sern.Handler.html#wrapper" class="tsd-kind-icon">wrapper</a>
</li>
<li class="tsd-kind-get-signature tsd-parent-kind-class">
<a href="Sern.Handler.html#client" class="tsd-kind-icon">client</a>
</li>
<li class="tsd-kind-get-signature tsd-parent-kind-class">
<a href="Sern.Handler.html#commandDir" class="tsd-kind-icon">command<wbr />Dir</a>
</li>
<li class="tsd-kind-get-signature tsd-parent-kind-class">
<a href="Sern.Handler.html#prefix" class="tsd-kind-icon">prefix</a>
</li>
<li class="tsd-kind-get-signature tsd-parent-kind-class">
<a href="Sern.Handler.html#privateServers" class="tsd-kind-icon">private<wbr />Servers</a>
</li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-private">
<a href="Sern.Handler.html#commandResult" class="tsd-kind-icon">command<wbr />Result</a>
</li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-private">
<a href="Sern.Handler.html#findModuleFrom" class="tsd-kind-icon">find<wbr />Module<wbr />From</a>
</li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-private">
<a href="Sern.Handler.html#interactionResult" class="tsd-kind-icon">interaction<wbr />Result</a>
</li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-private">
<a href="Sern.Handler.html#registerModules" class="tsd-kind-icon">register<wbr />Modules</a>
</li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-private">
<a href="Sern.Handler.html#reloadSlash" class="tsd-kind-icon">reload<wbr />Slash</a>
</li>
</ul>
</li>
</ul>
</nav>
</div>
</div>
</div>
<footer class="with-border-bottom">
<div class="container">
<h2>Legend</h2>
<div class="tsd-legend-group">
<ul class="tsd-legend">
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-private">
<span class="tsd-kind-icon">Private property</span>
</li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-private">
<span class="tsd-kind-icon">Private method</span>
</li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-constructor tsd-parent-kind-class"><span class="tsd-kind-icon">Constructor</span></li>
</ul>
</div>
<h2>Settings</h2>
<p>
Theme
<select id="theme">
<option value="os">OS</option>
<option value="light">Light</option>
<option value="dark">Dark</option>
</select>
</p>
</div>
</footer>
<div class="container tsd-generator">
<p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p>
</div>
<div class="overlay"></div>
<script src="../assets/main.js"></script>
</body>
</html>

View File

@@ -1,204 +0,0 @@
<!DOCTYPE html>
<html class="default">
<head>
<meta charset="utf-8" />
<meta http-equiv="x-ua-compatible" content="IE=edge" />
<title>CommandType - SernHandler</title>
<meta name="description" content="Documentation for sern-handler" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="../assets/style.css" />
<link rel="stylesheet" href="../assets/highlight.css" />
<script async src="../assets/search.js" id="search-script"></script>
</head>
<body>
<script>
document.body.classList.add(localStorage.getItem('tsd-theme') || 'os');
</script>
<header>
<div class="tsd-page-toolbar">
<div class="container">
<div class="table-wrap">
<div class="table-cell" id="tsd-search" data-base="..">
<div class="field">
<label for="tsd-search-field" class="tsd-widget search no-caption">Search</label
><input type="text" id="tsd-search-field" />
</div>
<ul class="results">
<li class="state loading">Preparing search index...</li>
<li class="state failure">The search index is not available</li>
</ul>
<a href="../index.html" class="title">sern-handler</a>
</div>
<div class="table-cell" id="tsd-widgets">
<div id="tsd-filter">
<a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a>
<div class="tsd-filter-group">
<div class="tsd-select" id="tsd-filter-visibility">
<span class="tsd-select-label">All</span>
<ul class="tsd-select-list">
<li data-value="public">Public</li>
<li data-value="protected">Public/Protected</li>
<li data-value="private" class="selected">All</li>
</ul>
</div>
<input type="checkbox" id="tsd-filter-inherited" checked /><label
class="tsd-widget"
for="tsd-filter-inherited"
>Inherited</label
><input type="checkbox" id="tsd-filter-externals" checked /><label
class="tsd-widget"
for="tsd-filter-externals"
>Externals</label
>
</div>
</div>
<a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a>
</div>
</div>
</div>
</div>
<div class="tsd-page-title">
<div class="container">
<ul class="tsd-breadcrumb">
<li><a href="../modules.html">sern-handler</a></li>
<li><a href="../modules/Sern.html">Sern</a></li>
<li><a href="Sern.CommandType.html">CommandType</a></li>
</ul>
<h1>Enumeration CommandType</h1>
</div>
</div>
</header>
<div class="container container-main">
<div class="row">
<div class="col-8 col-content">
<section class="tsd-panel-group tsd-index-group">
<h2>Index</h2>
<section class="tsd-panel tsd-index-panel">
<div class="tsd-index-content">
<section class="tsd-index-section">
<h3>Enumeration members</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-enum-member tsd-parent-kind-enum">
<a href="Sern.CommandType.html#SLASH" class="tsd-kind-icon">SLASH</a>
</li>
<li class="tsd-kind-enum-member tsd-parent-kind-enum">
<a href="Sern.CommandType.html#TEXT" class="tsd-kind-icon">TEXT</a>
</li>
</ul>
</section>
</div>
</section>
</section>
<section class="tsd-panel-group tsd-member-group">
<h2>Enumeration members</h2>
<section class="tsd-panel tsd-member tsd-kind-enum-member tsd-parent-kind-enum">
<a id="SLASH" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link">
SLASH<a href="#SLASH" aria-label="Permalink" class="tsd-anchor-icon"
><svg
xmlns="http://www.w3.org/2000/svg"
class="icon icon-tabler icon-tabler-link"
viewBox="0 0 24 24"
stroke-width="2"
stroke="currentColor"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
>
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path>
<path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg
></a>
</h3>
<div class="tsd-signature tsd-kind-icon">SLASH<span class="tsd-signature-symbol"> = 2</span></div>
<aside class="tsd-sources">
<ul>
<li>
Defined in
<a href="https://github.com/sern-handler/Sern/blob/29d92ca/src/handler/sern.ts#L303"
>handler/sern.ts:303</a
>
</li>
</ul>
</aside>
</section>
<section class="tsd-panel tsd-member tsd-kind-enum-member tsd-parent-kind-enum">
<a id="TEXT" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link">
TEXT<a href="#TEXT" aria-label="Permalink" class="tsd-anchor-icon"
><svg
xmlns="http://www.w3.org/2000/svg"
class="icon icon-tabler icon-tabler-link"
viewBox="0 0 24 24"
stroke-width="2"
stroke="currentColor"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
>
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path>
<path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg
></a>
</h3>
<div class="tsd-signature tsd-kind-icon">TEXT<span class="tsd-signature-symbol"> = 1</span></div>
<aside class="tsd-sources">
<ul>
<li>
Defined in
<a href="https://github.com/sern-handler/Sern/blob/29d92ca/src/handler/sern.ts#L302"
>handler/sern.ts:302</a
>
</li>
</ul>
</aside>
</section>
</section>
</div>
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
<nav class="tsd-navigation primary">
<ul>
<li class=""><a href="../modules.html">Exports</a></li>
<li class="current tsd-kind-namespace"><a href="../modules/Sern.html">Sern</a></li>
<li class="tsd-kind-namespace"><a href="../modules/Types.html">Types</a></li>
<li class="tsd-kind-namespace"><a href="../modules/Utils.html">Utils</a></li>
</ul>
</nav>
<nav class="tsd-navigation secondary menu-sticky">
<ul>
<li class="current tsd-kind-enum tsd-parent-kind-namespace">
<a href="Sern.CommandType.html" class="tsd-kind-icon">Command<wbr />Type</a>
<ul>
<li class="tsd-kind-enum-member tsd-parent-kind-enum">
<a href="Sern.CommandType.html#SLASH" class="tsd-kind-icon">SLASH</a>
</li>
<li class="tsd-kind-enum-member tsd-parent-kind-enum">
<a href="Sern.CommandType.html#TEXT" class="tsd-kind-icon">TEXT</a>
</li>
</ul>
</li>
</ul>
</nav>
</div>
</div>
</div>
<footer class="with-border-bottom">
<div class="container">
<h2>Settings</h2>
<p>
Theme
<select id="theme">
<option value="os">OS</option>
<option value="light">Light</option>
<option value="dark">Dark</option>
</select>
</p>
</div>
</footer>
<div class="container tsd-generator">
<p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p>
</div>
<div class="overlay"></div>
<script src="../assets/main.js"></script>
</body>
</html>

View File

@@ -1,168 +0,0 @@
<!DOCTYPE html>
<html class="default">
<head>
<meta charset="utf-8" />
<meta http-equiv="x-ua-compatible" content="IE=edge" />
<title>SernHandler</title>
<meta name="description" content="Documentation for sern-handler" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="assets/style.css" />
<link rel="stylesheet" href="assets/highlight.css" />
<script async src="assets/search.js" id="search-script"></script>
</head>
<body>
<script>
document.body.classList.add(localStorage.getItem('tsd-theme') || 'os');
</script>
<header>
<div class="tsd-page-toolbar">
<div class="container">
<div class="table-wrap">
<div class="table-cell" id="tsd-search" data-base=".">
<div class="field">
<label for="tsd-search-field" class="tsd-widget search no-caption">Search</label
><input type="text" id="tsd-search-field" />
</div>
<ul class="results">
<li class="state loading">Preparing search index...</li>
<li class="state failure">The search index is not available</li>
</ul>
<a href="index.html" class="title">sern-handler</a>
</div>
<div class="table-cell" id="tsd-widgets">
<div id="tsd-filter">
<a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a>
<div class="tsd-filter-group">
<div class="tsd-select" id="tsd-filter-visibility">
<span class="tsd-select-label">All</span>
<ul class="tsd-select-list">
<li data-value="public">Public</li>
<li data-value="protected">Public/Protected</li>
<li data-value="private" class="selected">All</li>
</ul>
</div>
<input type="checkbox" id="tsd-filter-inherited" checked /><label
class="tsd-widget"
for="tsd-filter-inherited"
>Inherited</label
><input type="checkbox" id="tsd-filter-externals" checked /><label
class="tsd-widget"
for="tsd-filter-externals"
>Externals</label
>
</div>
</div>
<a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a>
</div>
</div>
</div>
</div>
<div class="tsd-page-title">
<div class="container"><h1>sern-handler</h1></div>
</div>
</header>
<div class="container container-main">
<div class="row">
<div class="col-8 col-content">
<div class="tsd-panel tsd-typography">
<a href="#sern-handler" id="sern-handler" style="color: inherit; text-decoration: none">
<h1>Sern Handler</h1>
</a>
<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>
<a href="https://www.npmjs.com/package/sern-handler"
><img src="https://img.shields.io/badge/builds-stable" alt="Builds Passing"
/></a>
<p>
Sern can automate and streamline development of your discord bot with new version compatibility and full
customization.
</p>
<ul>
<li>A reincarnation of <a href="https://github.com/jacoobes/sern_handler">this old project</a></li>
</ul>
<a href="#installation" id="installation" style="color: inherit; text-decoration: none">
<h2>Installation</h2>
</a>
<pre><code class="language-sh"><span class="hl-0">npm install sern-handler</span>
</code></pre>
<pre><code class="language-sh"><span class="hl-0">yarn add sern-handler</span>
</code></pre>
<pre><code class="language-sh"><span class="hl-0">pnpm add sern-handler</span>
</code></pre>
<a href="#basic-usage" id="basic-usage" style="color: inherit; text-decoration: none">
<h2>Basic Usage</h2>
</a>
<a href="#indexjs" id="indexjs" style="color: inherit; text-decoration: none">
<h4><code>index.js</code></h4>
</a>
<pre><code class="language-js"><span class="hl-1">import</span><span class="hl-0"> { </span><span class="hl-2">Client</span><span class="hl-0">, </span><span class="hl-2">Intents</span><span class="hl-0"> } </span><span class="hl-1">from</span><span class="hl-0"> </span><span class="hl-3">&#39;discord.js&#39;</span><span class="hl-0">;</span><br/><span class="hl-1">import</span><span class="hl-0"> { </span><span class="hl-2">Sern</span><span class="hl-0"> } </span><span class="hl-1">from</span><span class="hl-0"> </span><span class="hl-3">&#39;sern-handler&#39;</span><span class="hl-0">;</span><br/><span class="hl-1">import</span><span class="hl-0"> { </span><span class="hl-2">prefix</span><span class="hl-0">, </span><span class="hl-2">token</span><span class="hl-0"> } </span><span class="hl-1">from</span><span class="hl-0"> </span><span class="hl-3">&#39;../src/secrets.json&#39;</span><span class="hl-0">;</span><br/><br/><span class="hl-4">const</span><span class="hl-0"> </span><span class="hl-5">client</span><span class="hl-0"> = </span><span class="hl-4">new</span><span class="hl-0"> </span><span class="hl-6">Client</span><span class="hl-0">({</span><br/><span class="hl-0"> </span><span class="hl-2">intents:</span><span class="hl-0"> [</span><br/><span class="hl-0"> </span><span class="hl-2">Intents</span><span class="hl-0">.</span><span class="hl-5">FLAGS</span><span class="hl-0">.</span><span class="hl-5">GUILDS</span><span class="hl-0">,</span><br/><span class="hl-0"> </span><span class="hl-2">Intents</span><span class="hl-0">.</span><span class="hl-5">FLAGS</span><span class="hl-0">.</span><span class="hl-5">GUILD_MESSAGES</span><span class="hl-0">,</span><br/><span class="hl-0"> </span><span class="hl-2">Intents</span><span class="hl-0">.</span><span class="hl-5">FLAGS</span><span class="hl-0">.</span><span class="hl-5">GUILD_MEMBERS</span><br/><span class="hl-0"> ]</span><br/><span class="hl-0">});</span><br/><br/><span class="hl-4">new</span><span class="hl-0"> </span><span class="hl-2">Sern</span><span class="hl-0">.</span><span class="hl-6">Handler</span><span class="hl-0">({</span><br/><span class="hl-0"> </span><span class="hl-2">client</span><span class="hl-0">, </span><br/><span class="hl-0"> </span><span class="hl-2">prefix</span><span class="hl-0">, </span><br/><span class="hl-0"> </span><span class="hl-2">commands :</span><span class="hl-0"> </span><span class="hl-3">&#39;dist/commands&#39;</span><span class="hl-0">, </span><br/><span class="hl-0"> </span><span class="hl-2">privateServers :</span><span class="hl-0"> [ </span><br/><span class="hl-0"> {</span><br/><span class="hl-0"> </span><span class="hl-2">test :</span><span class="hl-0"> </span><span class="hl-4">true</span><span class="hl-0">,</span><br/><span class="hl-0"> </span><span class="hl-2">id:</span><span class="hl-0"> </span><span class="hl-3">&#39;server-id&#39;</span><br/><span class="hl-0"> }</span><br/><span class="hl-0"> ],</span><br/><span class="hl-0"> </span><span class="hl-6">init</span><span class="hl-2">:</span><span class="hl-0"> </span><span class="hl-4">async</span><span class="hl-0"> (</span><span class="hl-2">handler</span><span class="hl-0">) </span><span class="hl-4">=&gt;</span><span class="hl-0"> {</span><br/><span class="hl-0"> </span><span class="hl-7">// Optional function to initialize anything else on bot startup</span><br/><span class="hl-0"> },</span><br/><span class="hl-0">});</span><br/><br/><br/><span class="hl-2">client</span><span class="hl-0">.</span><span class="hl-6">login</span><span class="hl-0">(</span><span class="hl-2">token</span><span class="hl-0">);</span>
</code></pre>
<a href="#pingjs" id="pingjs" style="color: inherit; text-decoration: none">
<h4><code>ping.js</code></h4>
</a>
<pre><code class="language-js"><span class="hl-1">import</span><span class="hl-0"> { </span><span class="hl-2">Sern</span><span class="hl-0">, </span><span class="hl-2">Types</span><span class="hl-0"> } </span><span class="hl-1">from</span><span class="hl-0"> </span><span class="hl-3">&#39;sern-handler&#39;</span><span class="hl-0">;</span><br/><span class="hl-1">import</span><span class="hl-0"> { </span><span class="hl-2">Ok</span><span class="hl-0"> } </span><span class="hl-1">from</span><span class="hl-0"> </span><span class="hl-3">&#39;ts-results&#39;</span><span class="hl-0">;</span><br/><br/><span class="hl-1">export</span><span class="hl-0"> </span><span class="hl-1">default</span><span class="hl-0"> {</span><br/><span class="hl-0"> </span><span class="hl-2">alias:</span><span class="hl-0"> [],</span><br/><span class="hl-0"> </span><span class="hl-2">desc :</span><span class="hl-0"> </span><span class="hl-3">&#39;A ping pong command&#39;</span><span class="hl-0">,</span><br/><span class="hl-0"> </span><span class="hl-2">visibility :</span><span class="hl-0"> </span><span class="hl-3">&#39;private&#39;</span><span class="hl-0">,</span><br/><span class="hl-0"> </span><span class="hl-2">test :</span><span class="hl-0"> </span><span class="hl-4">false</span><span class="hl-0">,</span><br/><span class="hl-0"> </span><span class="hl-2">type:</span><span class="hl-0"> </span><span class="hl-2">Sern</span><span class="hl-0">.</span><span class="hl-2">CommandType</span><span class="hl-0">.</span><span class="hl-5">SLASH</span><span class="hl-0"> | </span><span class="hl-2">Sern</span><span class="hl-0">.</span><span class="hl-2">CommandType</span><span class="hl-0">.</span><span class="hl-5">TEXT</span><span class="hl-0">,</span><br/><span class="hl-0"> </span><span class="hl-6">execute</span><span class="hl-2"> :</span><span class="hl-0"> </span><span class="hl-4">async</span><span class="hl-0"> ({ </span><span class="hl-2">message</span><span class="hl-0">, </span><span class="hl-2">interaction</span><span class="hl-0"> }, </span><span class="hl-2">args</span><span class="hl-0">) </span><span class="hl-4">=&gt;</span><span class="hl-0"> {</span><br/><span class="hl-0"> </span><span class="hl-2">interaction</span><span class="hl-0">.</span><span class="hl-6">reply</span><span class="hl-0">({ </span><span class="hl-2">content:</span><span class="hl-0"> </span><span class="hl-3">&#39;Pong! })</span><span class="hl-8">;</span><br/><span class="hl-0"> }</span><br/><span class="hl-0">};</span>
</code></pre>
<p>See <a href="https://sernhandler.js.org">documentation</a> for TypeScript examples and more</p>
<a href="#links-" id="links-" style="color: inherit; text-decoration: none">
<h2>Links <img src="https://img.shields.io/badge/Coming-Soon-purple" alt="link" /></h2>
</a>
<ul>
<li><a href="https://tmp.com">Official Documentation</a></li>
<li><a href="https://tmp.com">Example Bot</a></li>
<li><a href="https://google.com">Discord Server</a></li>
</ul>
<a href="#contribute" id="contribute" style="color: inherit; text-decoration: none">
<h2>Contribute</h2>
</a>
<ul>
<li>
Pull up on <a href="https://github.com/jacoobes/Sern/issues">issues</a> and tell me if there are bugs
</li>
<li>All kinds of contributions are welcomed!</li>
</ul>
</div>
</div>
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
<nav class="tsd-navigation primary">
<ul>
<li class="current"><a href="modules.html">Exports</a></li>
<li class="tsd-kind-namespace"><a href="modules/Sern.html">Sern</a></li>
<li class="tsd-kind-namespace"><a href="modules/Types.html">Types</a></li>
<li class="tsd-kind-namespace"><a href="modules/Utils.html">Utils</a></li>
</ul>
</nav>
<nav class="tsd-navigation secondary menu-sticky"><ul></ul></nav>
</div>
</div>
</div>
<footer class="with-border-bottom">
<div class="container">
<h2>Settings</h2>
<p>
Theme
<select id="theme">
<option value="os">OS</option>
<option value="light">Light</option>
<option value="dark">Dark</option>
</select>
</p>
</div>
</footer>
<div class="container tsd-generator">
<p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p>
</div>
<div class="overlay"></div>
<script src="assets/main.js"></script>
</body>
</html>

View File

@@ -1,559 +0,0 @@
<!DOCTYPE html>
<html class="default">
<head>
<meta charset="utf-8" />
<meta http-equiv="x-ua-compatible" content="IE=edge" />
<title>Module | sern-handler</title>
<meta name="description" content="Documentation for sern-handler" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="../assets/style.css" />
<link rel="stylesheet" href="../assets/highlight.css" />
<script async src="../assets/search.js" id="search-script"></script>
</head>
<body>
<script>
document.body.classList.add(localStorage.getItem('tsd-theme') || 'os');
</script>
<header>
<div class="tsd-page-toolbar">
<div class="container">
<div class="table-wrap">
<div class="table-cell" id="tsd-search" data-base="..">
<div class="field">
<label for="tsd-search-field" class="tsd-widget search no-caption">Search</label
><input type="text" id="tsd-search-field" />
</div>
<ul class="results">
<li class="state loading">Preparing search index...</li>
<li class="state failure">The search index is not available</li>
</ul>
<a href="../index.html" class="title">sern-handler</a>
</div>
<div class="table-cell" id="tsd-widgets">
<div id="tsd-filter">
<a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a>
<div class="tsd-filter-group">
<div class="tsd-select" id="tsd-filter-visibility">
<span class="tsd-select-label">All</span>
<ul class="tsd-select-list">
<li data-value="public">Public</li>
<li data-value="protected">Public/Protected</li>
<li data-value="private" class="selected">All</li>
</ul>
</div>
<input type="checkbox" id="tsd-filter-inherited" checked /><label
class="tsd-widget"
for="tsd-filter-inherited"
>Inherited</label
><input type="checkbox" id="tsd-filter-externals" checked /><label
class="tsd-widget"
for="tsd-filter-externals"
>Externals</label
>
</div>
</div>
<a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a>
</div>
</div>
</div>
</div>
<div class="tsd-page-title">
<div class="container">
<ul class="tsd-breadcrumb">
<li><a href="../modules.html">sern-handler</a></li>
<li><a href="../modules/Sern.html">Sern</a></li>
<li><a href="Sern.Module.html">Module</a></li>
</ul>
<h1>Interface Module&lt;T&gt;</h1>
</div>
</div>
</header>
<div class="container container-main">
<div class="row">
<div class="col-8 col-content">
<section class="tsd-panel tsd-comment">
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>An object that gets imported and acts as a command.</p>
</div>
<dl class="tsd-comment-tags">
<dt>property</dt>
<dd><p>{string} desc</p></dd>
<dt>property</dt>
<dd><p>{Visibility} visibility</p></dd>
<dt>property</dt>
<dd><p>{CommandType} type</p></dd>
<dt>property</dt>
<dd>
<p>
{(eventParams : Context, args : Ok&lt;T=string&gt;) =&gt; Awaitable&lt;possibleOutput | void&gt;}
execute
</p>
</dd>
<dt>prop</dt>
<dd></dd>
</dl>
</div>
</section>
<section class="tsd-panel tsd-type-parameters">
<h3>Type parameters</h3>
<ul class="tsd-type-parameters">
<li>
<h4>T = <span class="tsd-signature-type">string</span></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-hierarchy">
<h3>Hierarchy</h3>
<ul class="tsd-hierarchy">
<li><span class="target">Module</span></li>
</ul>
</section>
<section class="tsd-panel-group tsd-index-group">
<h2>Index</h2>
<section class="tsd-panel tsd-index-panel">
<div class="tsd-index-content">
<section class="tsd-index-section">
<h3>Properties</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-property tsd-parent-kind-interface">
<a href="Sern.Module.html#alias" class="tsd-kind-icon">alias</a>
</li>
<li class="tsd-kind-property tsd-parent-kind-interface">
<a href="Sern.Module.html#desc" class="tsd-kind-icon">desc</a>
</li>
<li class="tsd-kind-property tsd-parent-kind-interface">
<a href="Sern.Module.html#test" class="tsd-kind-icon">test</a>
</li>
<li class="tsd-kind-property tsd-parent-kind-interface">
<a href="Sern.Module.html#type" class="tsd-kind-icon">type</a>
</li>
<li class="tsd-kind-property tsd-parent-kind-interface">
<a href="Sern.Module.html#visibility" class="tsd-kind-icon">visibility</a>
</li>
</ul>
</section>
<section class="tsd-index-section">
<h3>Methods</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-method tsd-parent-kind-interface">
<a href="Sern.Module.html#execute" class="tsd-kind-icon">execute</a>
</li>
<li class="tsd-kind-method tsd-parent-kind-interface">
<a href="Sern.Module.html#parse" class="tsd-kind-icon">parse</a>
</li>
</ul>
</section>
</div>
</section>
</section>
<section class="tsd-panel-group tsd-member-group">
<h2>Properties</h2>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
<a id="alias" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link">
alias<a href="#alias" aria-label="Permalink" class="tsd-anchor-icon"
><svg
xmlns="http://www.w3.org/2000/svg"
class="icon icon-tabler icon-tabler-link"
viewBox="0 0 24 24"
stroke-width="2"
stroke="currentColor"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
>
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path>
<path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg
></a>
</h3>
<div class="tsd-signature tsd-kind-icon">
alias<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span
><span class="tsd-signature-symbol">[]</span>
</div>
<aside class="tsd-sources">
<ul>
<li>
Defined in
<a href="https://github.com/sern-handler/Sern/blob/29d92ca/src/handler/sern.ts#L288"
>handler/sern.ts:288</a
>
</li>
</ul>
</aside>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
<a id="desc" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link">
desc<a href="#desc" aria-label="Permalink" class="tsd-anchor-icon"
><svg
xmlns="http://www.w3.org/2000/svg"
class="icon icon-tabler icon-tabler-link"
viewBox="0 0 24 24"
stroke-width="2"
stroke="currentColor"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
>
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path>
<path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg
></a>
</h3>
<div class="tsd-signature tsd-kind-icon">
desc<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span>
</div>
<aside class="tsd-sources">
<ul>
<li>
Defined in
<a href="https://github.com/sern-handler/Sern/blob/29d92ca/src/handler/sern.ts#L289"
>handler/sern.ts:289</a
>
</li>
</ul>
</aside>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
<a id="test" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link">
test<a href="#test" aria-label="Permalink" class="tsd-anchor-icon"
><svg
xmlns="http://www.w3.org/2000/svg"
class="icon icon-tabler icon-tabler-link"
viewBox="0 0 24 24"
stroke-width="2"
stroke="currentColor"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
>
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path>
<path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg
></a>
</h3>
<div class="tsd-signature tsd-kind-icon">
test<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span>
</div>
<aside class="tsd-sources">
<ul>
<li>
Defined in
<a href="https://github.com/sern-handler/Sern/blob/29d92ca/src/handler/sern.ts#L292"
>handler/sern.ts:292</a
>
</li>
</ul>
</aside>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
<a id="type" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link">
type<a href="#type" aria-label="Permalink" class="tsd-anchor-icon"
><svg
xmlns="http://www.w3.org/2000/svg"
class="icon icon-tabler icon-tabler-link"
viewBox="0 0 24 24"
stroke-width="2"
stroke="currentColor"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
>
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path>
<path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg
></a>
</h3>
<div class="tsd-signature tsd-kind-icon">
type<span class="tsd-signature-symbol">:</span>
<a href="../enums/Sern.CommandType.html" class="tsd-signature-type" data-tsd-kind="Enumeration"
>CommandType</a
>
</div>
<aside class="tsd-sources">
<ul>
<li>
Defined in
<a href="https://github.com/sern-handler/Sern/blob/29d92ca/src/handler/sern.ts#L291"
>handler/sern.ts:291</a
>
</li>
</ul>
</aside>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
<a id="visibility" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link">
visibility<a href="#visibility" aria-label="Permalink" class="tsd-anchor-icon"
><svg
xmlns="http://www.w3.org/2000/svg"
class="icon icon-tabler icon-tabler-link"
viewBox="0 0 24 24"
stroke-width="2"
stroke="currentColor"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
>
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path>
<path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg
></a>
</h3>
<div class="tsd-signature tsd-kind-icon">
visibility<span class="tsd-signature-symbol">:</span>
<a href="../modules/Types.html#Visibility" class="tsd-signature-type" data-tsd-kind="Type alias"
>Visibility</a
>
</div>
<aside class="tsd-sources">
<ul>
<li>
Defined in
<a href="https://github.com/sern-handler/Sern/blob/29d92ca/src/handler/sern.ts#L290"
>handler/sern.ts:290</a
>
</li>
</ul>
</aside>
</section>
</section>
<section class="tsd-panel-group tsd-member-group">
<h2>Methods</h2>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface">
<a id="execute" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link">
execute<a href="#execute" aria-label="Permalink" class="tsd-anchor-icon"
><svg
xmlns="http://www.w3.org/2000/svg"
class="icon icon-tabler icon-tabler-link"
viewBox="0 0 24 24"
stroke-width="2"
stroke="currentColor"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
>
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path>
<path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg
></a>
</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-interface">
<li class="tsd-signature tsd-kind-icon">
execute<span class="tsd-signature-symbol">(</span>eventParams<span class="tsd-signature-symbol"
>: </span
><a href="../modules/Types.html#Context" class="tsd-signature-type" data-tsd-kind="Type alias"
>Context</a
>, args<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Ok</span
><span class="tsd-signature-symbol">&lt;</span
><span class="tsd-signature-type" data-tsd-kind="Type parameter">T</span
><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">)</span
><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Awaitable</span
><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span
><span class="tsd-signature-symbol"> | </span
><a href="../modules/Types.html#possibleOutput" class="tsd-signature-type" data-tsd-kind="Type alias"
>possibleOutput</a
><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">string</span
><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">&gt;</span>
</li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>
Defined in
<a href="https://github.com/sern-handler/Sern/blob/29d92ca/src/handler/sern.ts#L293"
>handler/sern.ts:293</a
>
</li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>
eventParams:
<a href="../modules/Types.html#Context" class="tsd-signature-type" data-tsd-kind="Type alias"
>Context</a
>
</h5>
</li>
<li>
<h5>
args: <span class="tsd-signature-type">Ok</span><span class="tsd-signature-symbol">&lt;</span
><span class="tsd-signature-type" data-tsd-kind="Type parameter">T</span
><span class="tsd-signature-symbol">&gt;</span>
</h5>
</li>
</ul>
<h4 class="tsd-returns-title">
Returns <span class="tsd-signature-type">Awaitable</span
><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span
><span class="tsd-signature-symbol"> | </span
><a
href="../modules/Types.html#possibleOutput"
class="tsd-signature-type"
data-tsd-kind="Type alias"
>possibleOutput</a
><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">string</span
><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">&gt;</span>
</h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface">
<a id="parse" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link">
<span class="tsd-flag ts-flagOptional">Optional</span> parse<a
href="#parse"
aria-label="Permalink"
class="tsd-anchor-icon"
><svg
xmlns="http://www.w3.org/2000/svg"
class="icon icon-tabler icon-tabler-link"
viewBox="0 0 24 24"
stroke-width="2"
stroke="currentColor"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
>
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path>
<path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg
></a>
</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-interface">
<li class="tsd-signature tsd-kind-icon">
parse<span class="tsd-signature-symbol">(</span>ctx<span class="tsd-signature-symbol">: </span
><a href="../modules/Types.html#Context" class="tsd-signature-type" data-tsd-kind="Type alias"
>Context</a
>, args<span class="tsd-signature-symbol">: </span
><a href="../modules/Types.html#Arg" class="tsd-signature-type" data-tsd-kind="Type alias">Arg</a
><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span
><a href="../modules/Utils.html#ArgType" class="tsd-signature-type" data-tsd-kind="Type alias"
>ArgType</a
><span class="tsd-signature-symbol">&lt;</span
><span class="tsd-signature-type" data-tsd-kind="Type parameter">T</span
><span class="tsd-signature-symbol">&gt;</span>
</li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>
Defined in
<a href="https://github.com/sern-handler/Sern/blob/29d92ca/src/handler/sern.ts#L294"
>handler/sern.ts:294</a
>
</li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>
ctx:
<a href="../modules/Types.html#Context" class="tsd-signature-type" data-tsd-kind="Type alias"
>Context</a
>
</h5>
</li>
<li>
<h5>
args:
<a href="../modules/Types.html#Arg" class="tsd-signature-type" data-tsd-kind="Type alias"
>Arg</a
>
</h5>
</li>
</ul>
<h4 class="tsd-returns-title">
Returns
<a href="../modules/Utils.html#ArgType" class="tsd-signature-type" data-tsd-kind="Type alias"
>ArgType</a
><span class="tsd-signature-symbol">&lt;</span
><span class="tsd-signature-type" data-tsd-kind="Type parameter">T</span
><span class="tsd-signature-symbol">&gt;</span>
</h4>
</li>
</ul>
</section>
</section>
</div>
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
<nav class="tsd-navigation primary">
<ul>
<li class=""><a href="../modules.html">Exports</a></li>
<li class="current tsd-kind-namespace"><a href="../modules/Sern.html">Sern</a></li>
<li class="tsd-kind-namespace"><a href="../modules/Types.html">Types</a></li>
<li class="tsd-kind-namespace"><a href="../modules/Utils.html">Utils</a></li>
</ul>
</nav>
<nav class="tsd-navigation secondary menu-sticky">
<ul>
<li class="current tsd-kind-interface tsd-parent-kind-namespace tsd-has-type-parameter">
<a href="Sern.Module.html" class="tsd-kind-icon">Module</a>
<ul>
<li class="tsd-kind-property tsd-parent-kind-interface">
<a href="Sern.Module.html#alias" class="tsd-kind-icon">alias</a>
</li>
<li class="tsd-kind-property tsd-parent-kind-interface">
<a href="Sern.Module.html#desc" class="tsd-kind-icon">desc</a>
</li>
<li class="tsd-kind-property tsd-parent-kind-interface">
<a href="Sern.Module.html#test" class="tsd-kind-icon">test</a>
</li>
<li class="tsd-kind-property tsd-parent-kind-interface">
<a href="Sern.Module.html#type" class="tsd-kind-icon">type</a>
</li>
<li class="tsd-kind-property tsd-parent-kind-interface">
<a href="Sern.Module.html#visibility" class="tsd-kind-icon">visibility</a>
</li>
<li class="tsd-kind-method tsd-parent-kind-interface">
<a href="Sern.Module.html#execute" class="tsd-kind-icon">execute</a>
</li>
<li class="tsd-kind-method tsd-parent-kind-interface">
<a href="Sern.Module.html#parse" class="tsd-kind-icon">parse</a>
</li>
</ul>
</li>
</ul>
</nav>
</div>
</div>
</div>
<footer class="with-border-bottom">
<div class="container">
<h2>Legend</h2>
<div class="tsd-legend-group">
<ul class="tsd-legend">
<li class="tsd-kind-property tsd-parent-kind-interface"><span class="tsd-kind-icon">Property</span></li>
<li class="tsd-kind-method tsd-parent-kind-interface"><span class="tsd-kind-icon">Method</span></li>
</ul>
</div>
<h2>Settings</h2>
<p>
Theme
<select id="theme">
<option value="os">OS</option>
<option value="light">Light</option>
<option value="dark">Dark</option>
</select>
</p>
</div>
</footer>
<div class="container tsd-generator">
<p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p>
</div>
<div class="overlay"></div>
<script src="../assets/main.js"></script>
</body>
</html>

View File

@@ -1,409 +0,0 @@
<!DOCTYPE html>
<html class="default">
<head>
<meta charset="utf-8" />
<meta http-equiv="x-ua-compatible" content="IE=edge" />
<title>Wrapper | sern-handler</title>
<meta name="description" content="Documentation for sern-handler" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="../assets/style.css" />
<link rel="stylesheet" href="../assets/highlight.css" />
<script async src="../assets/search.js" id="search-script"></script>
</head>
<body>
<script>
document.body.classList.add(localStorage.getItem('tsd-theme') || 'os');
</script>
<header>
<div class="tsd-page-toolbar">
<div class="container">
<div class="table-wrap">
<div class="table-cell" id="tsd-search" data-base="..">
<div class="field">
<label for="tsd-search-field" class="tsd-widget search no-caption">Search</label
><input type="text" id="tsd-search-field" />
</div>
<ul class="results">
<li class="state loading">Preparing search index...</li>
<li class="state failure">The search index is not available</li>
</ul>
<a href="../index.html" class="title">sern-handler</a>
</div>
<div class="table-cell" id="tsd-widgets">
<div id="tsd-filter">
<a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a>
<div class="tsd-filter-group">
<div class="tsd-select" id="tsd-filter-visibility">
<span class="tsd-select-label">All</span>
<ul class="tsd-select-list">
<li data-value="public">Public</li>
<li data-value="protected">Public/Protected</li>
<li data-value="private" class="selected">All</li>
</ul>
</div>
<input type="checkbox" id="tsd-filter-inherited" checked /><label
class="tsd-widget"
for="tsd-filter-inherited"
>Inherited</label
><input type="checkbox" id="tsd-filter-externals" checked /><label
class="tsd-widget"
for="tsd-filter-externals"
>Externals</label
>
</div>
</div>
<a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a>
</div>
</div>
</div>
</div>
<div class="tsd-page-title">
<div class="container">
<ul class="tsd-breadcrumb">
<li><a href="../modules.html">sern-handler</a></li>
<li><a href="../modules/Sern.html">Sern</a></li>
<li><a href="Sern.Wrapper.html">Wrapper</a></li>
</ul>
<h1>Interface Wrapper</h1>
</div>
</div>
</header>
<div class="container container-main">
<div class="row">
<div class="col-8 col-content">
<section class="tsd-panel tsd-comment">
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>An object to be passed into Sern.Handler constructor.</p>
</div>
<dl class="tsd-comment-tags">
<dt>property</dt>
<dd><p>{readonly Client} client</p></dd>
<dt>property</dt>
<dd><p>{readonly string} prefix</p></dd>
<dt>property</dt>
<dd><p>{readonly string} commands</p></dd>
<dt>prop</dt>
<dd><p>{(handler : Handler) =&gt; void)} init</p></dd>
<dt>property</dt>
<dd><p>{readonly {test: boolean, id: string}[]} privateServers</p></dd>
</dl>
</div>
</section>
<section class="tsd-panel tsd-hierarchy">
<h3>Hierarchy</h3>
<ul class="tsd-hierarchy">
<li><span class="target">Wrapper</span></li>
</ul>
</section>
<section class="tsd-panel-group tsd-index-group">
<h2>Index</h2>
<section class="tsd-panel tsd-index-panel">
<div class="tsd-index-content">
<section class="tsd-index-section">
<h3>Properties</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-property tsd-parent-kind-interface">
<a href="Sern.Wrapper.html#client" class="tsd-kind-icon">client</a>
</li>
<li class="tsd-kind-property tsd-parent-kind-interface">
<a href="Sern.Wrapper.html#commands" class="tsd-kind-icon">commands</a>
</li>
<li class="tsd-kind-property tsd-parent-kind-interface">
<a href="Sern.Wrapper.html#prefix" class="tsd-kind-icon">prefix</a>
</li>
<li class="tsd-kind-property tsd-parent-kind-interface">
<a href="Sern.Wrapper.html#privateServers" class="tsd-kind-icon">private<wbr />Servers</a>
</li>
</ul>
</section>
<section class="tsd-index-section">
<h3>Methods</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-method tsd-parent-kind-interface">
<a href="Sern.Wrapper.html#init" class="tsd-kind-icon">init</a>
</li>
</ul>
</section>
</div>
</section>
</section>
<section class="tsd-panel-group tsd-member-group">
<h2>Properties</h2>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
<a id="client" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link">
<span class="tsd-flag ts-flagReadonly">Readonly</span> client<a
href="#client"
aria-label="Permalink"
class="tsd-anchor-icon"
><svg
xmlns="http://www.w3.org/2000/svg"
class="icon icon-tabler icon-tabler-link"
viewBox="0 0 24 24"
stroke-width="2"
stroke="currentColor"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
>
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path>
<path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg
></a>
</h3>
<div class="tsd-signature tsd-kind-icon">
client<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Client</span
><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">boolean</span
><span class="tsd-signature-symbol">&gt;</span>
</div>
<aside class="tsd-sources">
<ul>
<li>
Defined in
<a href="https://github.com/sern-handler/Sern/blob/29d92ca/src/handler/sern.ts#L270"
>handler/sern.ts:270</a
>
</li>
</ul>
</aside>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
<a id="commands" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link">
<span class="tsd-flag ts-flagReadonly">Readonly</span> commands<a
href="#commands"
aria-label="Permalink"
class="tsd-anchor-icon"
><svg
xmlns="http://www.w3.org/2000/svg"
class="icon icon-tabler icon-tabler-link"
viewBox="0 0 24 24"
stroke-width="2"
stroke="currentColor"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
>
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path>
<path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg
></a>
</h3>
<div class="tsd-signature tsd-kind-icon">
commands<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span>
</div>
<aside class="tsd-sources">
<ul>
<li>
Defined in
<a href="https://github.com/sern-handler/Sern/blob/29d92ca/src/handler/sern.ts#L272"
>handler/sern.ts:272</a
>
</li>
</ul>
</aside>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
<a id="prefix" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link">
<span class="tsd-flag ts-flagReadonly">Readonly</span> prefix<a
href="#prefix"
aria-label="Permalink"
class="tsd-anchor-icon"
><svg
xmlns="http://www.w3.org/2000/svg"
class="icon icon-tabler icon-tabler-link"
viewBox="0 0 24 24"
stroke-width="2"
stroke="currentColor"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
>
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path>
<path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg
></a>
</h3>
<div class="tsd-signature tsd-kind-icon">
prefix<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span>
</div>
<aside class="tsd-sources">
<ul>
<li>
Defined in
<a href="https://github.com/sern-handler/Sern/blob/29d92ca/src/handler/sern.ts#L271"
>handler/sern.ts:271</a
>
</li>
</ul>
</aside>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
<a id="privateServers" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link">
<span class="tsd-flag ts-flagReadonly">Readonly</span> private<wbr />Servers<a
href="#privateServers"
aria-label="Permalink"
class="tsd-anchor-icon"
><svg
xmlns="http://www.w3.org/2000/svg"
class="icon icon-tabler icon-tabler-link"
viewBox="0 0 24 24"
stroke-width="2"
stroke="currentColor"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
>
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path>
<path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg
></a>
</h3>
<div class="tsd-signature tsd-kind-icon">
private<wbr />Servers<span class="tsd-signature-symbol">:</span>
<span class="tsd-signature-symbol">{ </span>id<span class="tsd-signature-symbol">: </span
><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>test<span
class="tsd-signature-symbol"
>: </span
><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> }</span
><span class="tsd-signature-symbol">[]</span>
</div>
<aside class="tsd-sources">
<ul>
<li>
Defined in
<a href="https://github.com/sern-handler/Sern/blob/29d92ca/src/handler/sern.ts#L274"
>handler/sern.ts:274</a
>
</li>
</ul>
</aside>
</section>
</section>
<section class="tsd-panel-group tsd-member-group">
<h2>Methods</h2>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface">
<a id="init" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link">
<span class="tsd-flag ts-flagOptional">Optional</span> init<a
href="#init"
aria-label="Permalink"
class="tsd-anchor-icon"
><svg
xmlns="http://www.w3.org/2000/svg"
class="icon icon-tabler icon-tabler-link"
viewBox="0 0 24 24"
stroke-width="2"
stroke="currentColor"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
>
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path>
<path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg
></a>
</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-interface">
<li class="tsd-signature tsd-kind-icon">
init<span class="tsd-signature-symbol">(</span>handler<span class="tsd-signature-symbol">: </span
><a href="../classes/Sern.Handler.html" class="tsd-signature-type" data-tsd-kind="Class">Handler</a
><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span
><span class="tsd-signature-type">void</span>
</li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>
Defined in
<a href="https://github.com/sern-handler/Sern/blob/29d92ca/src/handler/sern.ts#L273"
>handler/sern.ts:273</a
>
</li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>
handler:
<a href="../classes/Sern.Handler.html" class="tsd-signature-type" data-tsd-kind="Class"
>Handler</a
>
</h5>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
</li>
</ul>
</section>
</section>
</div>
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
<nav class="tsd-navigation primary">
<ul>
<li class=""><a href="../modules.html">Exports</a></li>
<li class="current tsd-kind-namespace"><a href="../modules/Sern.html">Sern</a></li>
<li class="tsd-kind-namespace"><a href="../modules/Types.html">Types</a></li>
<li class="tsd-kind-namespace"><a href="../modules/Utils.html">Utils</a></li>
</ul>
</nav>
<nav class="tsd-navigation secondary menu-sticky">
<ul>
<li class="current tsd-kind-interface tsd-parent-kind-namespace">
<a href="Sern.Wrapper.html" class="tsd-kind-icon">Wrapper</a>
<ul>
<li class="tsd-kind-property tsd-parent-kind-interface">
<a href="Sern.Wrapper.html#client" class="tsd-kind-icon">client</a>
</li>
<li class="tsd-kind-property tsd-parent-kind-interface">
<a href="Sern.Wrapper.html#commands" class="tsd-kind-icon">commands</a>
</li>
<li class="tsd-kind-property tsd-parent-kind-interface">
<a href="Sern.Wrapper.html#prefix" class="tsd-kind-icon">prefix</a>
</li>
<li class="tsd-kind-property tsd-parent-kind-interface">
<a href="Sern.Wrapper.html#privateServers" class="tsd-kind-icon">private<wbr />Servers</a>
</li>
<li class="tsd-kind-method tsd-parent-kind-interface">
<a href="Sern.Wrapper.html#init" class="tsd-kind-icon">init</a>
</li>
</ul>
</li>
</ul>
</nav>
</div>
</div>
</div>
<footer class="with-border-bottom">
<div class="container">
<h2>Legend</h2>
<div class="tsd-legend-group">
<ul class="tsd-legend">
<li class="tsd-kind-property tsd-parent-kind-interface"><span class="tsd-kind-icon">Property</span></li>
<li class="tsd-kind-method tsd-parent-kind-interface"><span class="tsd-kind-icon">Method</span></li>
</ul>
</div>
<h2>Settings</h2>
<p>
Theme
<select id="theme">
<option value="os">OS</option>
<option value="light">Light</option>
<option value="dark">Dark</option>
</select>
</p>
</div>
</footer>
<div class="container tsd-generator">
<p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p>
</div>
<div class="overlay"></div>
<script src="../assets/main.js"></script>
</body>
</html>

View File

@@ -1,115 +0,0 @@
<!DOCTYPE html>
<html class="default">
<head>
<meta charset="utf-8" />
<meta http-equiv="x-ua-compatible" content="IE=edge" />
<title>SernHandler</title>
<meta name="description" content="Documentation for sern-handler" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="assets/style.css" />
<link rel="stylesheet" href="assets/highlight.css" />
<script async src="assets/search.js" id="search-script"></script>
</head>
<body>
<script>
document.body.classList.add(localStorage.getItem('tsd-theme') || 'os');
</script>
<header>
<div class="tsd-page-toolbar">
<div class="container">
<div class="table-wrap">
<div class="table-cell" id="tsd-search" data-base=".">
<div class="field">
<label for="tsd-search-field" class="tsd-widget search no-caption">Search</label
><input type="text" id="tsd-search-field" />
</div>
<ul class="results">
<li class="state loading">Preparing search index...</li>
<li class="state failure">The search index is not available</li>
</ul>
<a href="index.html" class="title">SernHandler - Develop faster. Grow more.</a>
</div>
<div class="table-cell" id="tsd-widgets">
<div id="tsd-filter">
<a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a>
<div class="tsd-filter-group">
<div class="tsd-select" id="tsd-filter-visibility">
<span class="tsd-select-label">All</span>
<ul class="tsd-select-list">
<li data-value="public">Public</li>
<li data-value="protected">Public/Protected</li>
<li data-value="private" class="selected">All</li>
</ul>
</div>
<input type="checkbox" id="tsd-filter-inherited" checked /><label
class="tsd-widget"
for="tsd-filter-inherited"
>Inherited</label
><input type="checkbox" id="tsd-filter-externals" checked /><label
class="tsd-widget"
for="tsd-filter-externals"
>Externals</label
>
</div>
</div>
<a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a>
</div>
</div>
</div>
</div>
<div class="tsd-page-title">
<div class="container"><h1>sern-handler</h1></div>
</div>
</header>
<div class="container container-main">
<div class="row">
<div class="col-8 col-content">
<section class="tsd-panel-group tsd-index-group">
<h2>Index</h2>
<section class="tsd-panel tsd-index-panel">
<div class="tsd-index-content">
<section class="tsd-index-section">
<h3>Namespaces</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-namespace"><a href="modules/Sern.html" class="tsd-kind-icon">Sern</a></li>
<li class="tsd-kind-namespace"><a href="modules/Types.html" class="tsd-kind-icon">Types</a></li>
<li class="tsd-kind-namespace"><a href="modules/Utils.html" class="tsd-kind-icon">Utils</a></li>
</ul>
</section>
</div>
</section>
</section>
</div>
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
<nav class="tsd-navigation primary">
<ul>
<li class="current"><a href="modules.html">Exports</a></li>
<li class="tsd-kind-namespace"><a href="modules/Sern.html">Sern</a></li>
<li class="tsd-kind-namespace"><a href="modules/Types.html">Types</a></li>
<li class="tsd-kind-namespace"><a href="modules/Utils.html">Utils</a></li>
</ul>
</nav>
<nav class="tsd-navigation secondary menu-sticky"><ul></ul></nav>
</div>
</div>
</div>
<footer class="with-border-bottom">
<div class="container">
<h2>Settings</h2>
<p>
Theme
<select id="theme">
<option value="os">OS</option>
<option value="light">Light</option>
<option value="dark">Dark</option>
</select>
</p>
</div>
</footer>
<div class="container tsd-generator">
<p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p>
</div>
<div class="overlay"></div>
<script src="assets/main.js"></script>
</body>
</html>

View File

@@ -1,155 +0,0 @@
<!DOCTYPE html>
<html class="default">
<head>
<meta charset="utf-8" />
<meta http-equiv="x-ua-compatible" content="IE=edge" />
<title>Sern | sern-handler</title>
<meta name="description" content="Documentation for sern-handler" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="../assets/style.css" />
<link rel="stylesheet" href="../assets/highlight.css" />
<script async src="../assets/search.js" id="search-script"></script>
</head>
<body>
<script>
document.body.classList.add(localStorage.getItem('tsd-theme') || 'os');
</script>
<header>
<div class="tsd-page-toolbar">
<div class="container">
<div class="table-wrap">
<div class="table-cell" id="tsd-search" data-base="..">
<div class="field">
<label for="tsd-search-field" class="tsd-widget search no-caption">Search</label
><input type="text" id="tsd-search-field" />
</div>
<ul class="results">
<li class="state loading">Preparing search index...</li>
<li class="state failure">The search index is not available</li>
</ul>
<a href="../index.html" class="title">sern-handler</a>
</div>
<div class="table-cell" id="tsd-widgets">
<div id="tsd-filter">
<a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a>
<div class="tsd-filter-group">
<div class="tsd-select" id="tsd-filter-visibility">
<span class="tsd-select-label">All</span>
<ul class="tsd-select-list">
<li data-value="public">Public</li>
<li data-value="protected">Public/Protected</li>
<li data-value="private" class="selected">All</li>
</ul>
</div>
<input type="checkbox" id="tsd-filter-inherited" checked /><label
class="tsd-widget"
for="tsd-filter-inherited"
>Inherited</label
><input type="checkbox" id="tsd-filter-externals" checked /><label
class="tsd-widget"
for="tsd-filter-externals"
>Externals</label
>
</div>
</div>
<a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a>
</div>
</div>
</div>
</div>
<div class="tsd-page-title">
<div class="container">
<ul class="tsd-breadcrumb">
<li><a href="../modules.html">sern-handler</a></li>
<li><a href="Sern.html">Sern</a></li>
</ul>
<h1>Namespace Sern</h1>
</div>
</div>
</header>
<div class="container container-main">
<div class="row">
<div class="col-8 col-content">
<section class="tsd-panel-group tsd-index-group">
<h2>Index</h2>
<section class="tsd-panel tsd-index-panel">
<div class="tsd-index-content">
<section class="tsd-index-section">
<h3>Enumerations</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-enum tsd-parent-kind-namespace">
<a href="../enums/Sern.CommandType.html" class="tsd-kind-icon">Command<wbr />Type</a>
</li>
</ul>
</section>
<section class="tsd-index-section">
<h3>Classes</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-class tsd-parent-kind-namespace">
<a href="../classes/Sern.Handler.html" class="tsd-kind-icon">Handler</a>
</li>
</ul>
</section>
<section class="tsd-index-section">
<h3>Interfaces</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-interface tsd-parent-kind-namespace tsd-has-type-parameter">
<a href="../interfaces/Sern.Module.html" class="tsd-kind-icon">Module</a>
</li>
<li class="tsd-kind-interface tsd-parent-kind-namespace">
<a href="../interfaces/Sern.Wrapper.html" class="tsd-kind-icon">Wrapper</a>
</li>
</ul>
</section>
</div>
</section>
</section>
</div>
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
<nav class="tsd-navigation primary">
<ul>
<li class=""><a href="../modules.html">Exports</a></li>
<li class="current tsd-kind-namespace"><a href="Sern.html">Sern</a></li>
<li class="tsd-kind-namespace"><a href="Types.html">Types</a></li>
<li class="tsd-kind-namespace"><a href="Utils.html">Utils</a></li>
</ul>
</nav>
<nav class="tsd-navigation secondary menu-sticky">
<ul>
<li class="tsd-kind-enum tsd-parent-kind-namespace">
<a href="../enums/Sern.CommandType.html" class="tsd-kind-icon">Command<wbr />Type</a>
</li>
<li class="tsd-kind-class tsd-parent-kind-namespace">
<a href="../classes/Sern.Handler.html" class="tsd-kind-icon">Handler</a>
</li>
<li class="tsd-kind-interface tsd-parent-kind-namespace tsd-has-type-parameter">
<a href="../interfaces/Sern.Module.html" class="tsd-kind-icon">Module</a>
</li>
<li class="tsd-kind-interface tsd-parent-kind-namespace">
<a href="../interfaces/Sern.Wrapper.html" class="tsd-kind-icon">Wrapper</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<footer class="with-border-bottom">
<div class="container">
<h2>Settings</h2>
<p>
Theme
<select id="theme">
<option value="os">OS</option>
<option value="light">Light</option>
<option value="dark">Dark</option>
</select>
</p>
</div>
</footer>
<div class="container tsd-generator">
<p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p>
</div>
<div class="overlay"></div>
<script src="../assets/main.js"></script>
</body>
</html>

View File

@@ -1,533 +0,0 @@
<!DOCTYPE html>
<html class="default">
<head>
<meta charset="utf-8" />
<meta http-equiv="x-ua-compatible" content="IE=edge" />
<title>Types | sern-handler</title>
<meta name="description" content="Documentation for sern-handler" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="../assets/style.css" />
<link rel="stylesheet" href="../assets/highlight.css" />
<script async src="../assets/search.js" id="search-script"></script>
</head>
<body>
<script>
document.body.classList.add(localStorage.getItem('tsd-theme') || 'os');
</script>
<header>
<div class="tsd-page-toolbar">
<div class="container">
<div class="table-wrap">
<div class="table-cell" id="tsd-search" data-base="..">
<div class="field">
<label for="tsd-search-field" class="tsd-widget search no-caption">Search</label
><input type="text" id="tsd-search-field" />
</div>
<ul class="results">
<li class="state loading">Preparing search index...</li>
<li class="state failure">The search index is not available</li>
</ul>
<a href="../index.html" class="title">sern-handler</a>
</div>
<div class="table-cell" id="tsd-widgets">
<div id="tsd-filter">
<a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a>
<div class="tsd-filter-group">
<div class="tsd-select" id="tsd-filter-visibility">
<span class="tsd-select-label">All</span>
<ul class="tsd-select-list">
<li data-value="public">Public</li>
<li data-value="protected">Public/Protected</li>
<li data-value="private" class="selected">All</li>
</ul>
</div>
<input type="checkbox" id="tsd-filter-inherited" checked /><label
class="tsd-widget"
for="tsd-filter-inherited"
>Inherited</label
><input type="checkbox" id="tsd-filter-externals" checked /><label
class="tsd-widget"
for="tsd-filter-externals"
>Externals</label
>
</div>
</div>
<a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a>
</div>
</div>
</div>
</div>
<div class="tsd-page-title">
<div class="container">
<ul class="tsd-breadcrumb">
<li><a href="../modules.html">sern-handler</a></li>
<li><a href="Types.html">Types</a></li>
</ul>
<h1>Namespace Types</h1>
</div>
</div>
</header>
<div class="container container-main">
<div class="row">
<div class="col-8 col-content">
<section class="tsd-panel-group tsd-index-group">
<h2>Index</h2>
<section class="tsd-panel tsd-index-panel">
<div class="tsd-index-content">
<section class="tsd-index-section">
<h3>Type aliases</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-type-alias tsd-parent-kind-namespace">
<a href="Types.html#Arg" class="tsd-kind-icon">Arg</a>
</li>
<li class="tsd-kind-type-alias tsd-parent-kind-namespace">
<a href="Types.html#Context" class="tsd-kind-icon">Context</a>
</li>
<li class="tsd-kind-type-alias tsd-parent-kind-namespace tsd-has-type-parameter">
<a href="Types.html#Nullable" class="tsd-kind-icon">Nullable</a>
</li>
<li class="tsd-kind-type-alias tsd-parent-kind-namespace tsd-has-type-parameter">
<a href="Types.html#ParseType" class="tsd-kind-icon">Parse<wbr />Type</a>
</li>
<li class="tsd-kind-type-alias tsd-parent-kind-namespace">
<a href="Types.html#SlashOptions" class="tsd-kind-icon">Slash<wbr />Options</a>
</li>
<li class="tsd-kind-type-alias tsd-parent-kind-namespace">
<a href="Types.html#Visibility" class="tsd-kind-icon">Visibility</a>
</li>
<li class="tsd-kind-type-alias tsd-parent-kind-namespace">
<a href="Types.html#execute" class="tsd-kind-icon">execute</a>
</li>
<li class="tsd-kind-type-alias tsd-parent-kind-namespace tsd-has-type-parameter">
<a href="Types.html#possibleOutput" class="tsd-kind-icon">possible<wbr />Output</a>
</li>
</ul>
</section>
</div>
</section>
</section>
<section class="tsd-panel-group tsd-member-group">
<h2>Type aliases</h2>
<section class="tsd-panel tsd-member tsd-kind-type-alias tsd-parent-kind-namespace">
<a id="Arg" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link">
Arg<a href="#Arg" aria-label="Permalink" class="tsd-anchor-icon"
><svg
xmlns="http://www.w3.org/2000/svg"
class="icon icon-tabler icon-tabler-link"
viewBox="0 0 24 24"
stroke-width="2"
stroke="currentColor"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
>
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path>
<path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg
></a>
</h3>
<div class="tsd-signature tsd-kind-icon">
Arg<span class="tsd-signature-symbol">:</span>
<a href="Types.html#ParseType" class="tsd-signature-type" data-tsd-kind="Type alias">ParseType</a
><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-symbol">{ </span>slash<span
class="tsd-signature-symbol"
>: </span
><a href="Types.html#SlashOptions" class="tsd-signature-type" data-tsd-kind="Type alias">SlashOptions</a
><span class="tsd-signature-symbol">; </span>text<span class="tsd-signature-symbol">: </span
><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> }</span
><span class="tsd-signature-symbol">&gt;</span>
</div>
<aside class="tsd-sources">
<ul>
<li>
Defined in
<a href="https://github.com/sern-handler/Sern/blob/29d92ca/src/types/handler.ts#L30"
>types/handler.ts:30</a
>
</li>
</ul>
</aside>
</section>
<section class="tsd-panel tsd-member tsd-kind-type-alias tsd-parent-kind-namespace">
<a id="Context" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link">
Context<a href="#Context" aria-label="Permalink" class="tsd-anchor-icon"
><svg
xmlns="http://www.w3.org/2000/svg"
class="icon icon-tabler icon-tabler-link"
viewBox="0 0 24 24"
stroke-width="2"
stroke="currentColor"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
>
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path>
<path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg
></a>
</h3>
<div class="tsd-signature tsd-kind-icon">
Context<span class="tsd-signature-symbol">:</span>
<span class="tsd-signature-symbol">{ </span>interaction<span class="tsd-signature-symbol">: </span
><span class="tsd-signature-type">Option</span><span class="tsd-signature-symbol">&lt;</span
><span class="tsd-signature-type">CommandInteraction</span><span class="tsd-signature-symbol">&gt;</span
><span class="tsd-signature-symbol">; </span>message<span class="tsd-signature-symbol">: </span
><span class="tsd-signature-type">Option</span><span class="tsd-signature-symbol">&lt;</span
><span class="tsd-signature-type">Message</span><span class="tsd-signature-symbol">&gt;</span
><span class="tsd-signature-symbol"> }</span>
</div>
<aside class="tsd-sources">
<ul>
<li>
Defined in
<a href="https://github.com/sern-handler/Sern/blob/29d92ca/src/types/handler.ts#L25"
>types/handler.ts:25</a
>
</li>
</ul>
</aside>
<div class="tsd-type-declaration">
<h4>Type declaration</h4>
<ul class="tsd-parameters">
<li class="tsd-parameter">
<h5>
interaction<span class="tsd-signature-symbol">: </span
><span class="tsd-signature-type">Option</span><span class="tsd-signature-symbol">&lt;</span
><span class="tsd-signature-type">CommandInteraction</span
><span class="tsd-signature-symbol">&gt;</span>
</h5>
</li>
<li class="tsd-parameter">
<h5>
message<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Option</span
><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">Message</span
><span class="tsd-signature-symbol">&gt;</span>
</h5>
</li>
</ul>
</div>
</section>
<section class="tsd-panel tsd-member tsd-kind-type-alias tsd-parent-kind-namespace tsd-has-type-parameter">
<a id="Nullable" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link">
Nullable<a href="#Nullable" aria-label="Permalink" class="tsd-anchor-icon"
><svg
xmlns="http://www.w3.org/2000/svg"
class="icon icon-tabler icon-tabler-link"
viewBox="0 0 24 24"
stroke-width="2"
stroke="currentColor"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
>
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path>
<path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg
></a>
</h3>
<div class="tsd-signature tsd-kind-icon">
Nullable<span class="tsd-signature-symbol">&lt;</span
><span class="tsd-signature-type" data-tsd-kind="Type parameter">T</span
><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">:</span>
<span class="tsd-signature-type" data-tsd-kind="Type parameter">T</span
><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">null</span>
</div>
<aside class="tsd-sources">
<ul>
<li>
Defined in
<a href="https://github.com/sern-handler/Sern/blob/29d92ca/src/types/handler.ts#L17"
>types/handler.ts:17</a
>
</li>
</ul>
</aside>
<h4 class="tsd-type-parameters-title">Type parameters</h4>
<ul class="tsd-type-parameters">
<li><h4>T</h4></li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-type-alias tsd-parent-kind-namespace tsd-has-type-parameter">
<a id="ParseType" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link">
Parse<wbr />Type<a href="#ParseType" aria-label="Permalink" class="tsd-anchor-icon"
><svg
xmlns="http://www.w3.org/2000/svg"
class="icon icon-tabler icon-tabler-link"
viewBox="0 0 24 24"
stroke-width="2"
stroke="currentColor"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
>
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path>
<path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg
></a>
</h3>
<div class="tsd-signature tsd-kind-icon">
Parse<wbr />Type<span class="tsd-signature-symbol">&lt;</span
><span class="tsd-signature-type" data-tsd-kind="Type parameter">T</span
><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">:</span>
<span class="tsd-signature-symbol">{</span> <span class="tsd-signature-symbol">[ </span
><span class="tsd-signature-type">K</span><span class="tsd-signature-symbol"> in </span
><span class="tsd-signature-symbol">keyof </span
><span class="tsd-signature-type" data-tsd-kind="Type parameter">T</span
><span class="tsd-signature-symbol">]</span><span class="tsd-signature-symbol">: </span
><span class="tsd-signature-type" data-tsd-kind="Type parameter">T</span
><span class="tsd-signature-symbol">[</span><span class="tsd-signature-type">K</span
><span class="tsd-signature-symbol">]</span><span class="tsd-signature-symbol"> extends </span
><span class="tsd-signature-type">unknown</span><span class="tsd-signature-symbol"> ? </span
><span class="tsd-signature-symbol">[</span>k<span class="tsd-signature-symbol">: </span
><span class="tsd-signature-type">K</span><span class="tsd-signature-symbol">, </span>args<span
class="tsd-signature-symbol"
>: </span
><span class="tsd-signature-type" data-tsd-kind="Type parameter">T</span
><span class="tsd-signature-symbol">[</span><span class="tsd-signature-type">K</span
><span class="tsd-signature-symbol">]</span><span class="tsd-signature-symbol">]</span
><span class="tsd-signature-symbol"> : </span><span class="tsd-signature-type">never</span>
<span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">[</span
><span class="tsd-signature-symbol">keyof </span
><span class="tsd-signature-type" data-tsd-kind="Type parameter">T</span
><span class="tsd-signature-symbol">]</span>
</div>
<aside class="tsd-sources">
<ul>
<li>
Defined in
<a href="https://github.com/sern-handler/Sern/blob/29d92ca/src/types/handler.ts#L20"
>types/handler.ts:20</a
>
</li>
</ul>
</aside>
<h4 class="tsd-type-parameters-title">Type parameters</h4>
<ul class="tsd-type-parameters">
<li><h4>T</h4></li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-type-alias tsd-parent-kind-namespace">
<a id="SlashOptions" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link">
Slash<wbr />Options<a href="#SlashOptions" aria-label="Permalink" class="tsd-anchor-icon"
><svg
xmlns="http://www.w3.org/2000/svg"
class="icon icon-tabler icon-tabler-link"
viewBox="0 0 24 24"
stroke-width="2"
stroke="currentColor"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
>
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path>
<path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg
></a>
</h3>
<div class="tsd-signature tsd-kind-icon">
Slash<wbr />Options<span class="tsd-signature-symbol">:</span>
<span class="tsd-signature-type">Omit</span><span class="tsd-signature-symbol">&lt;</span
><span class="tsd-signature-type">CommandInteractionOptionResolver</span
><span class="tsd-signature-symbol">, </span
><span class="tsd-signature-type">&quot;getMessage&quot;</span
><span class="tsd-signature-symbol"> | </span
><span class="tsd-signature-type">&quot;getFocused&quot;</span
><span class="tsd-signature-symbol">&gt;</span>
</div>
<aside class="tsd-sources">
<ul>
<li>
Defined in
<a href="https://github.com/sern-handler/Sern/blob/29d92ca/src/types/handler.ts#L33"
>types/handler.ts:33</a
>
</li>
</ul>
</aside>
</section>
<section class="tsd-panel tsd-member tsd-kind-type-alias tsd-parent-kind-namespace">
<a id="Visibility" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link">
Visibility<a href="#Visibility" aria-label="Permalink" class="tsd-anchor-icon"
><svg
xmlns="http://www.w3.org/2000/svg"
class="icon icon-tabler icon-tabler-link"
viewBox="0 0 24 24"
stroke-width="2"
stroke="currentColor"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
>
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path>
<path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg
></a>
</h3>
<div class="tsd-signature tsd-kind-icon">
Visibility<span class="tsd-signature-symbol">:</span>
<span class="tsd-signature-type">&quot;private&quot;</span><span class="tsd-signature-symbol"> | </span
><span class="tsd-signature-type">&quot;public&quot;</span>
</div>
<aside class="tsd-sources">
<ul>
<li>
Defined in
<a href="https://github.com/sern-handler/Sern/blob/29d92ca/src/types/handler.ts#L13"
>types/handler.ts:13</a
>
</li>
</ul>
</aside>
</section>
<section class="tsd-panel tsd-member tsd-kind-type-alias tsd-parent-kind-namespace">
<a id="execute" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link">
execute<a href="#execute" aria-label="Permalink" class="tsd-anchor-icon"
><svg
xmlns="http://www.w3.org/2000/svg"
class="icon icon-tabler icon-tabler-link"
viewBox="0 0 24 24"
stroke-width="2"
stroke="currentColor"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
>
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path>
<path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg
></a>
</h3>
<div class="tsd-signature tsd-kind-icon">
execute<span class="tsd-signature-symbol">:</span>
<a href="../interfaces/Sern.Module.html" class="tsd-signature-type" data-tsd-kind="Interface">Module</a
><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">unknown</span
><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">[</span
><a href="../interfaces/Sern.Module.html#execute"
><span class="tsd-signature-type">&quot;execute&quot;</span></a
><span class="tsd-signature-symbol">]</span>
</div>
<aside class="tsd-sources">
<ul>
<li>
Defined in
<a href="https://github.com/sern-handler/Sern/blob/29d92ca/src/types/handler.ts#L18"
>types/handler.ts:18</a
>
</li>
</ul>
</aside>
</section>
<section class="tsd-panel tsd-member tsd-kind-type-alias tsd-parent-kind-namespace tsd-has-type-parameter">
<a id="possibleOutput" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link">
possible<wbr />Output<a href="#possibleOutput" aria-label="Permalink" class="tsd-anchor-icon"
><svg
xmlns="http://www.w3.org/2000/svg"
class="icon icon-tabler icon-tabler-link"
viewBox="0 0 24 24"
stroke-width="2"
stroke="currentColor"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
>
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path>
<path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg
></a>
</h3>
<div class="tsd-signature tsd-kind-icon">
possible<wbr />Output<span class="tsd-signature-symbol">&lt;</span
><span class="tsd-signature-type" data-tsd-kind="Type parameter">T</span
><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">:</span>
<span class="tsd-signature-type" data-tsd-kind="Type parameter">T</span
><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span
><span class="tsd-signature-type">MessagePayload</span><span class="tsd-signature-symbol"> &amp; </span
><span class="tsd-signature-type">MessageOptions</span><span class="tsd-signature-symbol">)</span>
</div>
<aside class="tsd-sources">
<ul>
<li>
Defined in
<a href="https://github.com/sern-handler/Sern/blob/29d92ca/src/types/handler.ts#L16"
>types/handler.ts:16</a
>
</li>
</ul>
</aside>
<h4 class="tsd-type-parameters-title">Type parameters</h4>
<ul class="tsd-type-parameters">
<li>
<h4>T = <span class="tsd-signature-type">string</span></h4>
</li>
</ul>
</section>
</section>
</div>
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
<nav class="tsd-navigation primary">
<ul>
<li class=""><a href="../modules.html">Exports</a></li>
<li class="tsd-kind-namespace"><a href="Sern.html">Sern</a></li>
<li class="current tsd-kind-namespace"><a href="Types.html">Types</a></li>
<li class="tsd-kind-namespace"><a href="Utils.html">Utils</a></li>
</ul>
</nav>
<nav class="tsd-navigation secondary menu-sticky">
<ul>
<li class="tsd-kind-type-alias tsd-parent-kind-namespace">
<a href="Types.html#Arg" class="tsd-kind-icon">Arg</a>
</li>
<li class="tsd-kind-type-alias tsd-parent-kind-namespace">
<a href="Types.html#Context" class="tsd-kind-icon">Context</a>
</li>
<li class="tsd-kind-type-alias tsd-parent-kind-namespace tsd-has-type-parameter">
<a href="Types.html#Nullable" class="tsd-kind-icon">Nullable</a>
</li>
<li class="tsd-kind-type-alias tsd-parent-kind-namespace tsd-has-type-parameter">
<a href="Types.html#ParseType" class="tsd-kind-icon">Parse<wbr />Type</a>
</li>
<li class="tsd-kind-type-alias tsd-parent-kind-namespace">
<a href="Types.html#SlashOptions" class="tsd-kind-icon">Slash<wbr />Options</a>
</li>
<li class="tsd-kind-type-alias tsd-parent-kind-namespace">
<a href="Types.html#Visibility" class="tsd-kind-icon">Visibility</a>
</li>
<li class="tsd-kind-type-alias tsd-parent-kind-namespace">
<a href="Types.html#execute" class="tsd-kind-icon">execute</a>
</li>
<li class="tsd-kind-type-alias tsd-parent-kind-namespace tsd-has-type-parameter">
<a href="Types.html#possibleOutput" class="tsd-kind-icon">possible<wbr />Output</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<footer class="with-border-bottom">
<div class="container">
<h2>Settings</h2>
<p>
Theme
<select id="theme">
<option value="os">OS</option>
<option value="light">Light</option>
<option value="dark">Dark</option>
</select>
</p>
</div>
</footer>
<div class="container tsd-generator">
<p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p>
</div>
<div class="overlay"></div>
<script src="../assets/main.js"></script>
</body>
</html>

View File

@@ -1,659 +0,0 @@
<!DOCTYPE html>
<html class="default">
<head>
<meta charset="utf-8" />
<meta http-equiv="x-ua-compatible" content="IE=edge" />
<title>Utils | sern-handler</title>
<meta name="description" content="Documentation for sern-handler" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="../assets/style.css" />
<link rel="stylesheet" href="../assets/highlight.css" />
<script async src="../assets/search.js" id="search-script"></script>
</head>
<body>
<script>
document.body.classList.add(localStorage.getItem('tsd-theme') || 'os');
</script>
<header>
<div class="tsd-page-toolbar">
<div class="container">
<div class="table-wrap">
<div class="table-cell" id="tsd-search" data-base="..">
<div class="field">
<label for="tsd-search-field" class="tsd-widget search no-caption">Search</label
><input type="text" id="tsd-search-field" />
</div>
<ul class="results">
<li class="state loading">Preparing search index...</li>
<li class="state failure">The search index is not available</li>
</ul>
<a href="../index.html" class="title">sern-handler</a>
</div>
<div class="table-cell" id="tsd-widgets">
<div id="tsd-filter">
<a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a>
<div class="tsd-filter-group">
<div class="tsd-select" id="tsd-filter-visibility">
<span class="tsd-select-label">All</span>
<ul class="tsd-select-list">
<li data-value="public">Public</li>
<li data-value="protected">Public/Protected</li>
<li data-value="private" class="selected">All</li>
</ul>
</div>
<input type="checkbox" id="tsd-filter-inherited" checked /><label
class="tsd-widget"
for="tsd-filter-inherited"
>Inherited</label
><input type="checkbox" id="tsd-filter-externals" checked /><label
class="tsd-widget"
for="tsd-filter-externals"
>Externals</label
>
</div>
</div>
<a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a>
</div>
</div>
</div>
</div>
<div class="tsd-page-title">
<div class="container">
<ul class="tsd-breadcrumb">
<li><a href="../modules.html">sern-handler</a></li>
<li><a href="Utils.html">Utils</a></li>
</ul>
<h1>Namespace Utils</h1>
</div>
</div>
</header>
<div class="container container-main">
<div class="row">
<div class="col-8 col-content">
<section class="tsd-panel-group tsd-index-group">
<h2>Index</h2>
<section class="tsd-panel tsd-index-panel">
<div class="tsd-index-content">
<section class="tsd-index-section">
<h3>Type aliases</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-type-alias tsd-parent-kind-namespace tsd-has-type-parameter">
<a href="Utils.html#ArgType" class="tsd-kind-icon">Arg<wbr />Type</a>
</li>
</ul>
</section>
<section class="tsd-index-section">
<h3>Functions</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-function tsd-parent-kind-namespace">
<a href="Utils.html#parseBool" class="tsd-kind-icon">parse<wbr />Bool</a>
</li>
<li class="tsd-kind-function tsd-parent-kind-namespace">
<a href="Utils.html#parseInt" class="tsd-kind-icon">parse<wbr />Int</a>
</li>
<li class="tsd-kind-function tsd-parent-kind-namespace">
<a href="Utils.html#toArr" class="tsd-kind-icon">to<wbr />Arr</a>
</li>
<li class="tsd-kind-function tsd-parent-kind-namespace">
<a href="Utils.html#toNegativeInt" class="tsd-kind-icon">to<wbr />Negative<wbr />Int</a>
</li>
<li class="tsd-kind-function tsd-parent-kind-namespace">
<a href="Utils.html#toPositiveInt" class="tsd-kind-icon">to<wbr />Positive<wbr />Int</a>
</li>
</ul>
</section>
</div>
</section>
</section>
<section class="tsd-panel-group tsd-member-group">
<h2>Type aliases</h2>
<section class="tsd-panel tsd-member tsd-kind-type-alias tsd-parent-kind-namespace tsd-has-type-parameter">
<a id="ArgType" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link">
Arg<wbr />Type<a href="#ArgType" aria-label="Permalink" class="tsd-anchor-icon"
><svg
xmlns="http://www.w3.org/2000/svg"
class="icon icon-tabler icon-tabler-link"
viewBox="0 0 24 24"
stroke-width="2"
stroke="currentColor"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
>
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path>
<path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg
></a>
</h3>
<div class="tsd-signature tsd-kind-icon">
Arg<wbr />Type<span class="tsd-signature-symbol">&lt;</span
><span class="tsd-signature-type" data-tsd-kind="Type parameter">T</span
><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">:</span>
<span class="tsd-signature-type">Result</span><span class="tsd-signature-symbol">&lt;</span
><span class="tsd-signature-type" data-tsd-kind="Type parameter">T</span
><span class="tsd-signature-symbol">, </span
><a href="Types.html#possibleOutput" class="tsd-signature-type" data-tsd-kind="Type alias"
>possibleOutput</a
><span class="tsd-signature-symbol">&gt;</span>
</div>
<aside class="tsd-sources">
<ul>
<li>
Defined in
<a
href="https://github.com/sern-handler/Sern/blob/29d92ca/src/handler/utilities/preprocessors/args.ts#L8"
>handler/utilities/preprocessors/args.ts:8</a
>
</li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>
Wrapper type taking <code>Ok(T)</code> or <code>Err(possibleOutput)</code> e.g
<code>Result&lt;T, possibleOutput</code>
</p>
</div>
</div>
<h4 class="tsd-type-parameters-title">Type parameters</h4>
<ul class="tsd-type-parameters">
<li><h4>T</h4></li>
</ul>
</section>
</section>
<section class="tsd-panel-group tsd-member-group">
<h2>Functions</h2>
<section class="tsd-panel tsd-member tsd-kind-function tsd-parent-kind-namespace">
<a id="parseBool" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link">
parse<wbr />Bool<a href="#parseBool" aria-label="Permalink" class="tsd-anchor-icon"
><svg
xmlns="http://www.w3.org/2000/svg"
class="icon icon-tabler icon-tabler-link"
viewBox="0 0 24 24"
stroke-width="2"
stroke="currentColor"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
>
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path>
<path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg
></a>
</h3>
<ul class="tsd-signatures tsd-kind-function tsd-parent-kind-namespace">
<li class="tsd-signature tsd-kind-icon">
parse<wbr />Bool<span class="tsd-signature-symbol">(</span>arg<span class="tsd-signature-symbol"
>: </span
><span class="tsd-signature-type">string</span>, onFailure<span class="tsd-signature-symbol">?: </span
><a href="Types.html#possibleOutput" class="tsd-signature-type" data-tsd-kind="Type alias"
>possibleOutput</a
><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">string</span
><span class="tsd-signature-symbol">&gt;</span>, regexes<span class="tsd-signature-symbol">?: </span
><span class="tsd-signature-symbol">{ </span>noRegex<span class="tsd-signature-symbol">: </span
><span class="tsd-signature-type">RegExp</span
><span class="tsd-signature-symbol">; </span>yesRegex<span class="tsd-signature-symbol">: </span
><span class="tsd-signature-type">RegExp</span><span class="tsd-signature-symbol"> }</span
><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span
><a href="Utils.html#ArgType" class="tsd-signature-type" data-tsd-kind="Type alias">ArgType</a
><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">boolean</span
><span class="tsd-signature-symbol">&gt;</span>
</li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>
Defined in
<a
href="https://github.com/sern-handler/Sern/blob/29d92ca/src/handler/utilities/preprocessors/args.ts#L31"
>handler/utilities/preprocessors/args.ts:31</a
>
</li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>arg: <span class="tsd-signature-type">string</span></h5>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>command arguments</p>
</div>
</div>
</li>
<li>
<h5>
onFailure:
<a href="Types.html#possibleOutput" class="tsd-signature-type" data-tsd-kind="Type alias"
>possibleOutput</a
><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">string</span
><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol"> = ...</span>
</h5>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>If cannot parse <code>arg</code> into boolean.</p>
</div>
</div>
</li>
<li>
<h5>
regexes: <span class="tsd-signature-symbol">{ </span>noRegex<span class="tsd-signature-symbol"
>: </span
><span class="tsd-signature-type">RegExp</span
><span class="tsd-signature-symbol">; </span>yesRegex<span class="tsd-signature-symbol">: </span
><span class="tsd-signature-type">RegExp</span><span class="tsd-signature-symbol"> }</span
><span class="tsd-signature-symbol"> = ...</span>
</h5>
<ul class="tsd-parameters">
<li class="tsd-parameter">
<h5>
no<wbr />Regex<span class="tsd-signature-symbol">: </span
><span class="tsd-signature-type">RegExp</span>
</h5>
</li>
<li class="tsd-parameter">
<h5>
yes<wbr />Regex<span class="tsd-signature-symbol">: </span
><span class="tsd-signature-type">RegExp</span>
</h5>
</li>
</ul>
</li>
</ul>
<h4 class="tsd-returns-title">
Returns
<a href="Utils.html#ArgType" class="tsd-signature-type" data-tsd-kind="Type alias">ArgType</a
><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">boolean</span
><span class="tsd-signature-symbol">&gt;</span>
</h4>
<div>
<p>attemps to parse <code>args</code> as a boolean</p>
</div>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-function tsd-parent-kind-namespace">
<a id="parseInt" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link">
parse<wbr />Int<a href="#parseInt" aria-label="Permalink" class="tsd-anchor-icon"
><svg
xmlns="http://www.w3.org/2000/svg"
class="icon icon-tabler icon-tabler-link"
viewBox="0 0 24 24"
stroke-width="2"
stroke="currentColor"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
>
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path>
<path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg
></a>
</h3>
<ul class="tsd-signatures tsd-kind-function tsd-parent-kind-namespace">
<li class="tsd-signature tsd-kind-icon">
parse<wbr />Int<span class="tsd-signature-symbol">(</span>arg<span class="tsd-signature-symbol"
>: </span
><span class="tsd-signature-type">string</span>, onFailure<span class="tsd-signature-symbol">: </span
><a href="Types.html#possibleOutput" class="tsd-signature-type" data-tsd-kind="Type alias"
>possibleOutput</a
><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">string</span
><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">)</span
><span class="tsd-signature-symbol">: </span
><a href="Utils.html#ArgType" class="tsd-signature-type" data-tsd-kind="Type alias">ArgType</a
><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">number</span
><span class="tsd-signature-symbol">&gt;</span>
</li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>
Defined in
<a
href="https://github.com/sern-handler/Sern/blob/29d92ca/src/handler/utilities/preprocessors/args.ts#L17"
>handler/utilities/preprocessors/args.ts:17</a
>
</li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>arg: <span class="tsd-signature-type">string</span></h5>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>command arguments</p>
</div>
</div>
</li>
<li>
<h5>
onFailure:
<a href="Types.html#possibleOutput" class="tsd-signature-type" data-tsd-kind="Type alias"
>possibleOutput</a
><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">string</span
><span class="tsd-signature-symbol">&gt;</span>
</h5>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>if <code>Number.parseInt</code> returns NaN</p>
</div>
</div>
</li>
</ul>
<h4 class="tsd-returns-title">
Returns
<a href="Utils.html#ArgType" class="tsd-signature-type" data-tsd-kind="Type alias">ArgType</a
><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">number</span
><span class="tsd-signature-symbol">&gt;</span>
</h4>
<div>
<p>Attempts to use <code>Number.parseInt()</code> on <code>arg</code></p>
</div>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-function tsd-parent-kind-namespace">
<a id="toArr" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link">
to<wbr />Arr<a href="#toArr" aria-label="Permalink" class="tsd-anchor-icon"
><svg
xmlns="http://www.w3.org/2000/svg"
class="icon icon-tabler icon-tabler-link"
viewBox="0 0 24 24"
stroke-width="2"
stroke="currentColor"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
>
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path>
<path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg
></a>
</h3>
<ul class="tsd-signatures tsd-kind-function tsd-parent-kind-namespace">
<li class="tsd-signature tsd-kind-icon">
to<wbr />Arr<span class="tsd-signature-symbol">(</span>arg<span class="tsd-signature-symbol">: </span
><span class="tsd-signature-type">string</span>, sep<span class="tsd-signature-symbol">?: </span
><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span
><span class="tsd-signature-symbol">: </span
><a href="Utils.html#ArgType" class="tsd-signature-type" data-tsd-kind="Type alias">ArgType</a
><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">string</span
><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">&gt;</span>
</li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>
Defined in
<a
href="https://github.com/sern-handler/Sern/blob/29d92ca/src/handler/utilities/preprocessors/args.ts#L55"
>handler/utilities/preprocessors/args.ts:55</a
>
</li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>arg: <span class="tsd-signature-type">string</span></h5>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>command arguments</p>
</div>
</div>
</li>
<li>
<h5>
sep: <span class="tsd-signature-type">string</span
><span class="tsd-signature-symbol"> = &#39; &#39;</span>
</h5>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>default separator = &#39; &#39;</p>
</div>
</div>
</li>
</ul>
<h4 class="tsd-returns-title">
Returns
<a href="Utils.html#ArgType" class="tsd-signature-type" data-tsd-kind="Type alias">ArgType</a
><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">string</span
><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">&gt;</span>
</h4>
<div></div>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-function tsd-parent-kind-namespace">
<a id="toNegativeInt" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link">
to<wbr />Negative<wbr />Int<a href="#toNegativeInt" aria-label="Permalink" class="tsd-anchor-icon"
><svg
xmlns="http://www.w3.org/2000/svg"
class="icon icon-tabler icon-tabler-link"
viewBox="0 0 24 24"
stroke-width="2"
stroke="currentColor"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
>
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path>
<path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg
></a>
</h3>
<ul class="tsd-signatures tsd-kind-function tsd-parent-kind-namespace">
<li class="tsd-signature tsd-kind-icon">
to<wbr />Negative<wbr />Int<span class="tsd-signature-symbol">(</span>arg<span
class="tsd-signature-symbol"
>: </span
><span class="tsd-signature-type">string</span>, onFailure<span class="tsd-signature-symbol">: </span
><a href="Types.html#possibleOutput" class="tsd-signature-type" data-tsd-kind="Type alias"
>possibleOutput</a
><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">string</span
><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">)</span
><span class="tsd-signature-symbol">: </span
><a href="Utils.html#ArgType" class="tsd-signature-type" data-tsd-kind="Type alias">ArgType</a
><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">number</span
><span class="tsd-signature-symbol">&gt;</span>
</li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>
Defined in
<a
href="https://github.com/sern-handler/Sern/blob/29d92ca/src/handler/utilities/preprocessors/args.ts#L76"
>handler/utilities/preprocessors/args.ts:76</a
>
</li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>arg: <span class="tsd-signature-type">string</span></h5>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>command arguments</p>
</div>
</div>
</li>
<li>
<h5>
onFailure:
<a href="Types.html#possibleOutput" class="tsd-signature-type" data-tsd-kind="Type alias"
>possibleOutput</a
><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">string</span
><span class="tsd-signature-symbol">&gt;</span>
</h5>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>delegates <code>parseInt</code></p>
</div>
</div>
</li>
</ul>
<h4 class="tsd-returns-title">
Returns
<a href="Utils.html#ArgType" class="tsd-signature-type" data-tsd-kind="Type alias">ArgType</a
><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">number</span
><span class="tsd-signature-symbol">&gt;</span>
</h4>
<div></div>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-function tsd-parent-kind-namespace">
<a id="toPositiveInt" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link">
to<wbr />Positive<wbr />Int<a href="#toPositiveInt" aria-label="Permalink" class="tsd-anchor-icon"
><svg
xmlns="http://www.w3.org/2000/svg"
class="icon icon-tabler icon-tabler-link"
viewBox="0 0 24 24"
stroke-width="2"
stroke="currentColor"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
>
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path>
<path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg
></a>
</h3>
<ul class="tsd-signatures tsd-kind-function tsd-parent-kind-namespace">
<li class="tsd-signature tsd-kind-icon">
to<wbr />Positive<wbr />Int<span class="tsd-signature-symbol">(</span>arg<span
class="tsd-signature-symbol"
>: </span
><span class="tsd-signature-type">string</span>, onFailure<span class="tsd-signature-symbol">: </span
><a href="Types.html#possibleOutput" class="tsd-signature-type" data-tsd-kind="Type alias"
>possibleOutput</a
><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">string</span
><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">)</span
><span class="tsd-signature-symbol">: </span
><a href="Utils.html#ArgType" class="tsd-signature-type" data-tsd-kind="Type alias">ArgType</a
><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">number</span
><span class="tsd-signature-symbol">&gt;</span>
</li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>
Defined in
<a
href="https://github.com/sern-handler/Sern/blob/29d92ca/src/handler/utilities/preprocessors/args.ts#L66"
>handler/utilities/preprocessors/args.ts:66</a
>
</li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>arg: <span class="tsd-signature-type">string</span></h5>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>command arguments</p>
</div>
</div>
</li>
<li>
<h5>
onFailure:
<a href="Types.html#possibleOutput" class="tsd-signature-type" data-tsd-kind="Type alias"
>possibleOutput</a
><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">string</span
><span class="tsd-signature-symbol">&gt;</span>
</h5>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>delegates <code>Utils.parseInt</code></p>
</div>
</div>
</li>
</ul>
<h4 class="tsd-returns-title">
Returns
<a href="Utils.html#ArgType" class="tsd-signature-type" data-tsd-kind="Type alias">ArgType</a
><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">number</span
><span class="tsd-signature-symbol">&gt;</span>
</h4>
<div></div>
</li>
</ul>
</section>
</section>
</div>
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
<nav class="tsd-navigation primary">
<ul>
<li class=""><a href="../modules.html">Exports</a></li>
<li class="tsd-kind-namespace"><a href="Sern.html">Sern</a></li>
<li class="tsd-kind-namespace"><a href="Types.html">Types</a></li>
<li class="current tsd-kind-namespace"><a href="Utils.html">Utils</a></li>
</ul>
</nav>
<nav class="tsd-navigation secondary menu-sticky">
<ul>
<li class="tsd-kind-type-alias tsd-parent-kind-namespace tsd-has-type-parameter">
<a href="Utils.html#ArgType" class="tsd-kind-icon">Arg<wbr />Type</a>
</li>
<li class="tsd-kind-function tsd-parent-kind-namespace">
<a href="Utils.html#parseBool" class="tsd-kind-icon">parse<wbr />Bool</a>
</li>
<li class="tsd-kind-function tsd-parent-kind-namespace">
<a href="Utils.html#parseInt" class="tsd-kind-icon">parse<wbr />Int</a>
</li>
<li class="tsd-kind-function tsd-parent-kind-namespace">
<a href="Utils.html#toArr" class="tsd-kind-icon">to<wbr />Arr</a>
</li>
<li class="tsd-kind-function tsd-parent-kind-namespace">
<a href="Utils.html#toNegativeInt" class="tsd-kind-icon">to<wbr />Negative<wbr />Int</a>
</li>
<li class="tsd-kind-function tsd-parent-kind-namespace">
<a href="Utils.html#toPositiveInt" class="tsd-kind-icon">to<wbr />Positive<wbr />Int</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<footer class="with-border-bottom">
<div class="container">
<h2>Settings</h2>
<p>
Theme
<select id="theme">
<option value="os">OS</option>
<option value="light">Light</option>
<option value="dark">Dark</option>
</select>
</p>
</div>
</footer>
<div class="container tsd-generator">
<p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p>
</div>
<div class="overlay"></div>
<script src="../assets/main.js"></script>
</body>
</html>

View File

@@ -1,194 +0,0 @@
/*
* For a detailed explanation regarding each configuration property and type check, visit:
* https://jestjs.io/docs/configuration
*/
export default {
// All imported modules in your tests should be mocked automatically
// automock: false,
// Stop running tests after `n` failures
// bail: 0,
// The directory where Jest should store its cached dependency information
// cacheDirectory: "C:\\Users\\jeyus\\AppData\\Local\\Temp\\jest",
// Automatically clear mock calls, instances and results before every test
clearMocks: true,
// Indicates whether the coverage information should be collected while executing the test
collectCoverage: true,
// An array of glob patterns indicating a set of files for which coverage information should be collected
// collectCoverageFrom: undefined,
// The directory where Jest should output its coverage files
coverageDirectory: 'coverage',
// An array of regexp pattern strings used to skip coverage collection
// coveragePathIgnorePatterns: [
// "\\\\node_modules\\\\"
// ],
// Indicates which provider should be used to instrument code for coverage
coverageProvider: 'v8',
// A list of reporter names that Jest uses when writing coverage reports
// coverageReporters: [
// "json",
// "text",
// "lcov",
// "clover"
// ],
// An object that configures minimum threshold enforcement for coverage results
// coverageThreshold: undefined,
// A path to a custom dependency extractor
// dependencyExtractor: undefined,
// Make calling deprecated APIs throw helpful error messages
// errorOnDeprecated: false,
// Force coverage collection from ignored files using an array of glob patterns
// forceCoverageMatch: [],
// A path to a module which exports an async function that is triggered once before all test suites
// globalSetup: undefined,
// A path to a module which exports an async function that is triggered once after all test suites
// globalTeardown: undefined,
// A set of global variables that need to be available in all test environments
// globals: {},
// The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers.
// maxWorkers: "50%",
// An array of directory names to be searched recursively up from the requiring module's location
// moduleDirectories: [
// "node_modules"
// ],
// An array of file extensions your modules use
// moduleFileExtensions: [
// "js",
// "jsx",
// "ts",
// "tsx",
// "json",
// "node"
// ],
// A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module
// moduleNameMapper: {},
// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
// modulePathIgnorePatterns: [],
// Activates notifications for test results
// notify: false,
// An enum that specifies notification mode. Requires { notify: true }
// notifyMode: "failure-change",
// A preset that is used as a base for Jest's configuration
// preset: undefined,
// Run tests from one or more projects
// projects: undefined,
// Use this configuration option to add custom reporters to Jest
// reporters: undefined,
// Automatically reset mock state before every test
// resetMocks: false,
// Reset the module registry before running each individual test
// resetModules: false,
// A path to a custom resolver
// resolver: undefined,
// Automatically restore mock state and implementation before every test
// restoreMocks: false,
// The root directory that Jest should scan for tests and modules within
// rootDir: undefined,
// A list of paths to directories that Jest should use to search for files in
// roots: [
// "<rootDir>"
// ],
// Allows you to use a custom runner instead of Jest's default test runner
// runner: "jest-runner",
// The paths to modules that run some code to configure or set up the testing environment before each test
// setupFiles: [],
// A list of paths to modules that run some code to configure or set up the testing framework before each test
// setupFilesAfterEnv: [],
// The number of seconds after which a test is considered as slow and reported as such in the results.
// slowTestThreshold: 5,
// A list of paths to snapshot serializer modules Jest should use for snapshot testing
// snapshotSerializers: [],
// The test environment that will be used for testing
// testEnvironment: "jest-environment-node",
// Options that will be passed to the testEnvironment
// testEnvironmentOptions: {},
// Adds a location field to test results
// testLocationInResults: false,
// The glob patterns Jest uses to detect test files
// testMatch: [
// "**/__tests__/**/*.[jt]s?(x)",
// "**/?(*.)+(spec|test).[tj]s?(x)"
// ],
// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
// testPathIgnorePatterns: [
// "\\\\node_modules\\\\"
// ],
// The regexp pattern or array of patterns that Jest uses to detect test files
// testRegex: [],
// This option allows the use of a custom results processor
// testResultsProcessor: undefined,
// This option allows use of a custom test runner
// testRunner: "jest-circus/runner",
// This option sets the URL for the jsdom environment. It is reflected in properties such as location.href
// testURL: "http://localhost",
// Setting this value to "fake" allows the use of fake timers for functions such as "setTimeout"
// timers: "real",
// A map from regular expressions to paths to transformers
// transform: undefined,
// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
// transformIgnorePatterns: [
// "\\\\node_modules\\\\",
// "\\.pnp\\.[^\\\\]+$"
// ],
// An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
// unmockedModulePathPatterns: undefined,
// Indicates whether each individual test should be reported during the run
// verbose: undefined,
// An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
// watchPathIgnorePatterns: [],
// Whether to use watchman for file crawling
// watchman: true,
};

10989
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{ {
"name": "@sern/handler", "name": "@sern/handler",
"version": "1.0.1-beta", "version": "1.1.0-beta",
"description": "A customizable, batteries-included, powerful discord.js framework to automate and streamline bot development.", "description": "A customizable, batteries-included, powerful discord.js framework to automate and streamline bot development.",
"main": "dist/index.js", "main": "dist/index.js",
"scripts": { "scripts": {
@@ -9,7 +9,6 @@
"lint": "eslint src/**/*.ts", "lint": "eslint src/**/*.ts",
"format": "eslint src/**/*.ts --fix", "format": "eslint src/**/*.ts --fix",
"release": "standard-version && git push --follow-tags", "release": "standard-version && git push --follow-tags",
"test": "jest --coverage --verbose",
"commit": "cz" "commit": "cz"
}, },
"keywords": [ "keywords": [
@@ -33,18 +32,16 @@
"eslint": "^8.8.0", "eslint": "^8.8.0",
"@typescript-eslint/parser": "^5.10.2", "@typescript-eslint/parser": "^5.10.2",
"@typescript-eslint/eslint-plugin": "^5.10.2", "@typescript-eslint/eslint-plugin": "^5.10.2",
"@babel/core": "^7.17.2",
"@babel/preset-env": "^7.16.11",
"@babel/preset-typescript": "^7.16.7",
"@types/jest": "^27.4.0",
"babel-jest": "^27.5.1",
"cz-conventional-changelog": "3.0.1", "cz-conventional-changelog": "3.0.1",
"jest": "^27.5.1",
"prettier": "2.6.2", "prettier": "2.6.2",
"standard-version": "^9.3.2", "standard-version": "^9.3.2",
"typedoc": "^0.22.11", "typescript": "4.5.5"
"typescript": "^4.5.5"
}, },
"repository": {
"type": "git",
"url": "git+https://github.com/sern-handler/handler.git"
},
"homepage": "https://sern-handler.js.org",
"config": { "config": {
"commitizen": { "commitizen": {
"path": "cz-conventional-changelog" "path": "cz-conventional-changelog"

View File

@@ -14,17 +14,20 @@ import Context from '../structures/context';
import { controller } from '../sern'; import { controller } from '../sern';
import type { Module } from '../structures/module'; import type { Module } from '../structures/module';
import { import {
isApplicationCommand,
isAutocomplete,
isButton, isButton,
isChatInputCommand, isChatInputCommand,
isMessageComponent,
isMessageCtxMenuCmd, isMessageCtxMenuCmd,
isPromise, isModalSubmit,
isSelectMenu, isSelectMenu,
isUserContextMenuCmd, isUserContextMenuCmd,
} from '../utilities/predicates'; } from '../utilities/predicates';
import { filterCorrectModule } from './observableHandling'; import { filterCorrectModule } from './observableHandling';
import { CommandType } from '../structures/enums'; import { CommandType } from '../structures/enums';
import type { Result } from 'ts-results';
import type { AutocompleteInteraction } from 'discord.js'; import type { AutocompleteInteraction } from 'discord.js';
import { asyncResolveArray } from '../utilities/asyncResolveArray';
function applicationCommandHandler(mod: Module | undefined, interaction: CommandInteraction) { function applicationCommandHandler(mod: Module | undefined, interaction: CommandInteraction) {
const mod$ = <T extends CommandType>(cmdTy: T) => of(mod).pipe(filterCorrectModule(cmdTy)); const mod$ = <T extends CommandType>(cmdTy: T) => of(mod).pipe(filterCorrectModule(cmdTy));
@@ -150,7 +153,7 @@ function autoCmpHandler(mod: Module | undefined, interaction: AutocompleteIntera
const selectedOption = mod.options?.find(o => o.autocomplete && o.name === choice.name); const selectedOption = mod.options?.find(o => o.autocomplete && o.name === choice.name);
if (selectedOption !== undefined && selectedOption.autocomplete) { if (selectedOption !== undefined && selectedOption.autocomplete) {
return of( return of(
selectedOption.command.onEvent.map(e => e.execute([interaction], controller)), selectedOption.command.onEvent.map(e => e.execute(interaction, controller)),
).pipe( ).pipe(
map(res => ({ map(res => ({
mod, mod,
@@ -179,24 +182,24 @@ export function onInteractionCreate(wrapper: Wrapper) {
.pipe( .pipe(
/*processing plugins*/ /*processing plugins*/
concatMap(interaction => { concatMap(interaction => {
if (interaction.isCommand()) { if (isApplicationCommand(interaction)) {
const modul = const modul =
Files.ApplicationCommands[interaction.commandType].get( Files.ApplicationCommands[interaction.commandType].get(
interaction.commandName, interaction.commandName,
) ?? Files.BothCommands.get(interaction.commandName); ) ?? Files.BothCommands.get(interaction.commandName);
return applicationCommandHandler(modul, interaction); return applicationCommandHandler(modul, interaction);
} }
if (interaction.isMessageComponent()) { if (isMessageComponent(interaction)) {
const modul = Files.MessageCompCommands[interaction.componentType].get( const modul = Files.MessageCompCommands[interaction.componentType].get(
interaction.customId, interaction.customId,
); );
return messageComponentInteractionHandler(modul, interaction); return messageComponentInteractionHandler(modul, interaction);
} }
if (interaction.isModalSubmit()) { if (isModalSubmit(interaction)) {
const modul = Files.ModalSubmitCommands.get(interaction.customId); const modul = Files.ModalSubmitCommands.get(interaction.customId);
return modalHandler(modul, interaction); return modalHandler(modul, interaction);
} }
if (interaction.isAutocomplete()) { if (isAutocomplete(interaction)) {
const modul = const modul =
Files.ApplicationCommands['1'].get(interaction.commandName) ?? Files.ApplicationCommands['1'].get(interaction.commandName) ??
Files.BothCommands.get(interaction.commandName); Files.BothCommands.get(interaction.commandName);
@@ -207,19 +210,13 @@ export function onInteractionCreate(wrapper: Wrapper) {
) )
.subscribe({ .subscribe({
async next({ mod, res: eventPluginRes, execute }) { async next({ mod, res: eventPluginRes, execute }) {
const ePlugArr: Result<void, void>[] = []; const ePlugArr = await asyncResolveArray(eventPluginRes);
for await (const res of eventPluginRes) {
if (isPromise(res)) {
ePlugArr.push(res);
}
ePlugArr.push(res as Awaited<Result<void, void>>);
}
if (ePlugArr.every(e => e.ok)) { if (ePlugArr.every(e => e.ok)) {
await execute(); await execute();
wrapper.sernEmitter?.emit('module.activate', { success: true, module: mod! }); wrapper.sernEmitter?.emit('module.activate', { type: 'success', module: mod! });
} else { } else {
wrapper.sernEmitter?.emit('module.activate', { wrapper.sernEmitter?.emit('module.activate', {
success: false, type: 'failure',
module: mod!, module: mod!,
reason: SernError.PluginFailure, reason: SernError.PluginFailure,
}); });

View File

@@ -1,6 +1,5 @@
import type { Message } from 'discord.js'; import type { Message } from 'discord.js';
import { concatMap, from, fromEvent, map, Observable, of } from 'rxjs'; import { concatMap, from, fromEvent, map, Observable, of } from 'rxjs';
import type { Args } from '../..';
import { controller } from '../sern'; import { controller } from '../sern';
import Context from '../structures/context'; import Context from '../structures/context';
import type Wrapper from '../structures/wrapper'; import type Wrapper from '../structures/wrapper';
@@ -9,6 +8,7 @@ import * as Files from '../utilities/readFile';
import { filterCorrectModule, ignoreNonBot } from './observableHandling'; import { filterCorrectModule, ignoreNonBot } from './observableHandling';
import { CommandType } from '../structures/enums'; import { CommandType } from '../structures/enums';
import { SernError } from '../structures/errors'; import { SernError } from '../structures/errors';
import { asyncResolveArray } from '../utilities/asyncResolveArray';
export const onMessageCreate = (wrapper: Wrapper) => { export const onMessageCreate = (wrapper: Wrapper) => {
const { client, defaultPrefix } = wrapper; const { client, defaultPrefix } = wrapper;
@@ -22,7 +22,7 @@ export const onMessageCreate = (wrapper: Wrapper) => {
const [prefix, ...rest] = fmt(message, defaultPrefix); const [prefix, ...rest] = fmt(message, defaultPrefix);
return { return {
ctx: Context.wrap(message), ctx: Context.wrap(message),
args: <Args>['text', rest], args: <['text', string[]]>['text', rest],
mod: mod:
Files.TextCommands.text.get(prefix) ?? Files.TextCommands.text.get(prefix) ??
Files.BothCommands.get(prefix) ?? Files.BothCommands.get(prefix) ??
@@ -41,7 +41,7 @@ export const onMessageCreate = (wrapper: Wrapper) => {
const processEventPlugins$ = ensureModuleType$.pipe( const processEventPlugins$ = ensureModuleType$.pipe(
concatMap(({ ctx, args, mod }) => { concatMap(({ ctx, args, mod }) => {
const res = Promise.all( const res = asyncResolveArray(
mod.onEvent.map(ePlug => { mod.onEvent.map(ePlug => {
return ePlug.execute([ctx, args], controller); return ePlug.execute([ctx, args], controller);
}), }),
@@ -54,11 +54,11 @@ export const onMessageCreate = (wrapper: Wrapper) => {
next({ mod, ctx, args, res }) { next({ mod, ctx, args, res }) {
if (res.every(pl => pl.ok)) { if (res.every(pl => pl.ok)) {
Promise.resolve(mod.execute(ctx, args)).then(() => { Promise.resolve(mod.execute(ctx, args)).then(() => {
wrapper.sernEmitter?.emit('module.activate', { success: true, module: mod! }); wrapper.sernEmitter?.emit('module.activate', { type: 'success', module: mod! });
}); });
} else { } else {
wrapper.sernEmitter?.emit('module.activate', { wrapper.sernEmitter?.emit('module.activate', {
success: false, type: 'failure',
module: mod!, module: mod!,
reason: SernError.PluginFailure, reason: SernError.PluginFailure,
}); });

View File

@@ -1,11 +1,12 @@
import type { Message } from 'discord.js'; import type { Message } from 'discord.js';
import { Observable, throwError } from 'rxjs'; import { Observable, throwError } from 'rxjs';
import { SernError } from '../structures/errors'; import { SernError } from '../structures/errors';
import type { Module, ModuleDefs } from '../structures/module'; import type { Module, CommandModuleDefs } from '../structures/module';
import { correctModuleType } from '../utilities/predicates'; import { correctModuleType } from '../utilities/predicates';
export function filterCorrectModule<T extends keyof ModuleDefs>(cmdType: T) { import type { Result } from 'ts-results';
export function filterCorrectModule<T extends keyof CommandModuleDefs>(cmdType: T) {
return (src: Observable<Module | undefined>) => return (src: Observable<Module | undefined>) =>
new Observable<ModuleDefs[T]>(subscriber => { new Observable<CommandModuleDefs[T]>(subscriber => {
return src.subscribe({ return src.subscribe({
next(mod) { next(mod) {
if (mod === undefined) { if (mod === undefined) {
@@ -42,3 +43,24 @@ export function ignoreNonBot(prefix: string) {
}); });
}); });
} }
/**
* If the current value in Result stream is an error, calls callback.
* @param cb
*/
export function errTap<T extends Module>(cb: (err: SernError) => void) {
return (src: Observable<Result<{ mod: T; absPath: string }, SernError>>) =>
new Observable<{ mod: T; absPath: string }>(subscriber => {
return src.subscribe({
next(value) {
if (value.err) {
cb(value.val);
} else {
subscriber.next(value.val);
}
},
error: e => subscriber.error(e),
complete: () => subscriber.complete(),
});
});
}

View File

@@ -1,66 +1,54 @@
import { import { concat, concatMap, from, fromEvent, map, Observable, of, skip, take } from 'rxjs';
concat,
concatMap,
from,
fromEvent,
map,
Observable,
of,
skip,
take,
throwError,
} from 'rxjs';
import { basename } from 'path'; import { basename } from 'path';
import * as Files from '../utilities/readFile'; import * as Files from '../utilities/readFile';
import type Wrapper from '../structures/wrapper'; import type Wrapper from '../structures/wrapper';
import { controller } from '../sern';
import type { Result } from 'ts-results'; import type { Result } from 'ts-results';
import { Err, Ok } from 'ts-results'; import { Err, Ok } from 'ts-results';
import type { Awaitable } from 'discord.js'; import type { Awaitable } from 'discord.js';
import { ApplicationCommandType, ComponentType } from 'discord.js'; import { ApplicationCommandType, ComponentType } from 'discord.js';
import type { Module } from '../structures/module'; import type { CommandModule } from '../structures/module';
import { match } from 'ts-pattern'; import { match } from 'ts-pattern';
import { SernError } from '../structures/errors'; import { SernError } from '../structures/errors';
import type { DefinitelyDefined } from '../../types/handler'; import type { DefinedCommandModule } from '../../types/handler';
import { CommandType, PluginType } from '../structures/enums'; import { CommandType, PluginType } from '../structures/enums';
import { errTap } from './observableHandling';
import { processCommandPlugins } from './userDefinedEventsHandling';
export const onReady = (wrapper: Wrapper) => { export function onReady(wrapper: Wrapper) {
const { client, commands } = wrapper; const { client, commands } = wrapper;
const ready$ = fromEvent(client, 'ready').pipe(take(1), skip(1)); const ready$ = fromEvent(client, 'ready').pipe(take(1), skip(1));
const processCommandFiles$ = Files.buildData(commands).pipe(
// Using sernModule function already checks if module is not EventModule
const processCommandFiles$ = Files.buildData<CommandModule>(commands).pipe(
errTap(reason => {
wrapper.sernEmitter?.emit('module.register', {
type: 'failure',
module: undefined,
reason,
});
}),
map(({ mod, absPath }) => { map(({ mod, absPath }) => {
if (mod?.name === undefined) { return {
const name = Files.fmtFileName(basename(absPath)); absPath,
return { name, ...mod }; mod: <DefinedCommandModule>{
} name: mod?.name ?? Files.fmtFileName(basename(absPath)),
return mod; description: mod?.description ?? '...',
...mod,
},
};
}), }),
); );
const processPlugins$ = processCommandFiles$.pipe( const processPlugins$ = processCommandFiles$.pipe(
concatMap(mod => { concatMap(payload => {
if (mod.type === CommandType.Autocomplete) { const cmdPluginRes = processCommandPlugins(wrapper, payload);
return throwError( return of({ mod: payload.mod, cmdPluginRes });
() =>
SernError.NonValidModuleType +
`. You cannot use command plugins and Autocomplete.`,
);
}
const cmdPluginsRes =
mod.plugins?.map(plug => {
return {
...plug,
name: plug?.name ?? 'Unnamed Plugin',
execute: plug.execute(client, mod, controller),
};
}) ?? [];
return of({ mod, cmdPluginsRes });
}), }),
); );
( (
concat(ready$, processPlugins$) as Observable<{ concat(ready$, processPlugins$) as Observable<{
mod: DefinitelyDefined<Module, { name: string }>; mod: DefinedCommandModule;
cmdPluginsRes: { cmdPluginRes: {
execute: Awaitable<Result<void, void>>; execute: Awaitable<Result<void, void>>;
type: PluginType.Command; type: PluginType.Command;
name: string; name: string;
@@ -69,39 +57,36 @@ export const onReady = (wrapper: Wrapper) => {
}> }>
) )
.pipe( .pipe(
concatMap(pl => concatMap(pl => {
from( return from(
//refactor, this allocates too many objects
Promise.all( Promise.all(
pl.cmdPluginsRes.map(async e => ({ ...e, execute: await e.execute })), pl.cmdPluginRes.map(async e => ({ ...e, execute: await e.execute })),
), ),
).pipe(map(res => ({ ...pl, cmdPluginsRes: res }))), ).pipe(map(res => ({ ...pl, cmdPluginsRes: res })));
), }),
) )
.subscribe(({ mod, cmdPluginsRes }) => { .subscribe(({ mod, cmdPluginsRes }) => {
const loadedPluginsCorrectly = cmdPluginsRes.every(res => res.execute.ok); const loadedPluginsCorrectly = cmdPluginsRes.every(({ execute }) => execute.ok);
if (loadedPluginsCorrectly) { if (loadedPluginsCorrectly) {
const res = registerModule(mod); const res = registerModule(mod);
if (res.err) { if (res.err) {
throw Error( throw Error(SernError.NonValidModuleType);
SernError.NonValidModuleType +
', or loading modules was handled incorrectly. ' +
'Check commands path and command files!',
);
} }
wrapper.sernEmitter?.emit('module.register', { success: true, module: mod }); wrapper.sernEmitter?.emit('module.register', { type: 'success', module: mod });
} else { } else {
wrapper.sernEmitter?.emit('module.register', { wrapper.sernEmitter?.emit('module.register', {
success: false, type: 'failure',
module: mod, module: mod,
reason: SernError.PluginFailure, reason: SernError.PluginFailure,
}); });
} }
}); });
}; }
function registerModule(mod: DefinitelyDefined<Module, { name: string }>): Result<void, void> { function registerModule(mod: DefinedCommandModule): Result<void, void> {
const name = mod.name; const name = mod.name;
return match<Module>(mod) return match<DefinedCommandModule>(mod)
.with({ type: CommandType.Text }, mod => { .with({ type: CommandType.Text }, mod => {
mod.alias?.forEach(a => Files.TextCommands.aliases.set(a, mod)); mod.alias?.forEach(a => Files.TextCommands.aliases.set(a, mod));
Files.TextCommands.text.set(name, mod); Files.TextCommands.text.set(name, mod);

View File

@@ -0,0 +1,93 @@
import { from, fromEvent, map } from 'rxjs';
import * as Files from '../utilities/readFile';
import { buildData, ExternalEventEmitters } from '../utilities/readFile';
import { controller } from '../sern';
import type { DefinedCommandModule, DefinedEventModule, SpreadParams } from '../../types/handler';
import type { EventModule } from '../structures/module';
import type Wrapper from '../structures/wrapper';
import { basename } from 'path';
import { match } from 'ts-pattern';
import { isDiscordEvent, isSernEvent } from '../utilities/predicates';
import { errTap } from './observableHandling';
/**
* Utility function to process command plugins for all Modules
* @param wrapper
* @param payload
*/
export function processCommandPlugins<T extends DefinedCommandModule>(
wrapper: Wrapper,
payload: { mod: T; absPath: string },
) {
return payload.mod.plugins.map(plug => ({
...plug,
name: plug?.name ?? 'Unnamed Plugin',
description: plug?.description ?? '...',
execute: plug.execute(wrapper, payload, controller),
}));
}
export function processEvents(
wrapper: Wrapper,
events:
| string
| { mod: EventModule; absPath: string }[]
| (() => { mod: EventModule; absPath: string }[]),
) {
const eventStream$ = eventObservable$(wrapper, events);
const normalize$ = eventStream$.pipe(
map(({ mod, absPath }) => {
return <DefinedEventModule>{
name: mod?.name ?? Files.fmtFileName(basename(absPath)),
description: mod?.description ?? '...',
...mod,
};
}),
);
normalize$.subscribe(e => {
const emitter = isSernEvent(e)
? wrapper?.sernEmitter
: isDiscordEvent(e)
? wrapper.client
: ExternalEventEmitters.get(e.emitter);
if (emitter === undefined) {
throw new Error(`Cannot find event emitter as it is undefined`);
}
//Would add sern event emitter for events loaded, attached onto sern emitter, but could lead to unwanted behavior!
fromEvent(emitter, e.name, e.execute as SpreadParams<typeof e.execute>).subscribe();
});
}
function eventObservable$(
{ sernEmitter }: Wrapper,
events:
| string
| { mod: EventModule; absPath: string }[]
| (() => { mod: EventModule; absPath: string }[]),
) {
return match(events)
.when(Array.isArray, (arr: { mod: EventModule; absPath: string }[]) => {
return from(arr);
})
.when(
e => typeof e === 'string',
(eventsDir: string) => {
return buildData<EventModule>(eventsDir).pipe(
errTap(reason =>
sernEmitter?.emit('module.register', {
type: 'failure',
module: undefined,
reason,
}),
),
);
},
)
.when(
e => typeof e === 'function',
(evs: () => { mod: EventModule; absPath: string }[]) => {
return from(evs());
},
)
.run();
}

View File

@@ -1,22 +1,29 @@
// /*
// Plugins can be inserted on all commands and are emitted * Plugins can be inserted on all commands and are emitted
// *
// 1. on ready event, where all commands are loaded. * 1. On ready event, where all commands are loaded.
// 2. on corresponding observable (command triggers) * 2. On corresponding observable (when command triggers)
// *
// The goal of plugins is to organize commands and * The goal of plugins is to organize commands and
// provide extensions to repetitive patterns * provide extensions to repetitive patterns
// examples include refreshing modules, * examples include refreshing modules,
// categorizing commands, cooldowns, permissions, etc. * categorizing commands, cooldowns, permissions, etc.
// Plugins are reminiscent of middleware in express. * Plugins are reminiscent of middleware in express.
// */
import type { Awaitable, Client } from 'discord.js'; import type { AutocompleteInteraction, Awaitable, Client, ClientEvents } from 'discord.js';
import type { Err, Ok, Result } from 'ts-results'; import type { Err, Ok, Result } from 'ts-results';
import type { Module, Override } from '../..'; import type { CommandType, DefinitelyDefined, Override, SernEventsMapping } from '../..';
import { CommandType } from '../..'; import { EventType, PluginType } from '../..';
import type { AutocompleteCommand, BaseModule, ModuleDefs } from '../structures/module'; import type { BaseModule, CommandModuleDefs, EventModuleDefs } from '../structures/module';
import { PluginType } from '../structures/enums'; import type { EventEmitter } from 'events';
import type {
DiscordEventCommand,
ExternalEventCommand,
SernEventCommand,
} from '../structures/events';
import type SernEmitter from '../sernEmitter';
import type Wrapper from '../structures/wrapper';
export interface Controller { export interface Controller {
next: () => Ok<void>; next: () => Ok<void>;
@@ -30,79 +37,150 @@ type BasePlugin = Override<
} }
>; >;
export type CommandPlugin<T extends keyof ModuleDefs = keyof ModuleDefs> = { export type CommandPlugin<T extends keyof CommandModuleDefs = keyof CommandModuleDefs> = {
[K in T]: Override< [K in T]: Override<
BasePlugin, BasePlugin,
{ {
type: PluginType.Command; type: PluginType.Command;
execute: ( execute: (
wrapper: Client, wrapper: Wrapper,
module: ModuleDefs[T], payload: {
mod: DefinitelyDefined<CommandModuleDefs[T], 'name' | 'description'>;
absPath: string;
},
controller: Controller, controller: Controller,
) => Awaitable<Result<void, void>>; ) => Awaitable<Result<void, void>>;
} }
>; >;
}[T]; }[T];
export type EventPlugin<T extends keyof ModuleDefs = keyof ModuleDefs> = {
export type DiscordEmitterPlugin = Override<
BasePlugin,
{
type: PluginType.Command;
execute: (
wrapper: Client,
module: DefinitelyDefined<DiscordEventCommand, 'name' | 'description'>,
controller: Controller,
) => Awaitable<Result<void, void>>;
}
>;
export type ExternalEmitterPlugin<T extends EventEmitter = EventEmitter> = Override<
BasePlugin,
{
type: PluginType.Command;
execute: (
wrapper: T,
module: DefinitelyDefined<ExternalEventCommand, 'name' | 'description'>,
controller: Controller,
) => Awaitable<Result<void, void>>;
}
>;
export type SernEmitterPlugin = Override<
BasePlugin,
{
type: PluginType.Command;
execute: (
wrapper: SernEmitter,
module: DefinitelyDefined<SernEventCommand, 'name' | 'description'>,
controller: Controller,
) => Awaitable<Result<void, void>>;
}
>;
export type AutocompletePlugin = Override<
BaseModule,
{
type: PluginType.Event;
execute: (
autocmp: AutocompleteInteraction,
controlller: Controller,
) => Awaitable<Result<void, void>>;
}
>;
export type EventPlugin<T extends keyof CommandModuleDefs = keyof CommandModuleDefs> = {
[K in T]: Override< [K in T]: Override<
BasePlugin, BasePlugin,
{ {
type: PluginType.Event; type: PluginType.Event;
execute: ( execute: (
event: Parameters<ModuleDefs[K]['execute']>, event: Parameters<CommandModuleDefs[K]['execute']>,
controller: Controller, controller: Controller,
) => Awaitable<Result<void, void>>; ) => Awaitable<Result<void, void>>;
} }
>; >;
}[T]; }[T];
//Syntactic sugar on hold export type SernEventPlugin<T extends keyof SernEventsMapping = keyof SernEventsMapping> = Override<
// export function plugins<T extends keyof ModuleDefs>( BasePlugin,
// ...plug: (EventPlugin<T> | CommandPlugin<T>)[] {
// ) { name?: T;
// return plug; type: PluginType.Event;
// } execute: (
args: SernEventsMapping[T],
controller: Controller,
) => Awaitable<Result<void, void>>;
}
>;
type ModuleNoPlugins = { export type ExternalEventPlugin = Override<
[T in keyof ModuleDefs]: Omit<ModuleDefs[T], 'plugins' | 'onEvent'>; BasePlugin,
{
type: PluginType.Event;
execute: (args: unknown[], controller: Controller) => Awaitable<Result<void, void>>;
}
>;
export type DiscordEventPlugin<T extends keyof ClientEvents = keyof ClientEvents> = Override<
BasePlugin,
{
name?: T;
type: PluginType.Event;
execute: (args: ClientEvents[T], controller: Controller) => Awaitable<Result<void, void>>;
}
>;
export type CommandModuleNoPlugins = {
[T in CommandType]: Omit<CommandModuleDefs[T], 'plugins' | 'onEvent'>;
};
export type EventModulesNoPlugins = {
[T in EventType]: Omit<EventModuleDefs[T], 'plugins' | 'onEvent'>;
};
/**
* Event Module Event Plugins
*/
export type EventModuleEventPluginDefs = {
[EventType.Discord]: DiscordEventPlugin;
[EventType.Sern]: SernEventPlugin;
[EventType.External]: ExternalEventPlugin;
}; };
function isEventPlugin<T extends CommandType>( /**
e: CommandPlugin<T> | EventPlugin<T>, * Event Module Command Plugins
): e is EventPlugin<T> { */
return e.type === PluginType.Event; export type EventModuleCommandPluginDefs = {
} [EventType.Discord]: DiscordEmitterPlugin;
function isCommandPlugin<T extends CommandType>( [EventType.Sern]: SernEmitterPlugin;
e: CommandPlugin<T> | EventPlugin<T>, [EventType.External]: ExternalEmitterPlugin;
): e is CommandPlugin<T> { };
return !isEventPlugin(e);
}
//TODO: I WANT BETTER TYPINGS AHHHHHHHHHHHHHHH
export function sernModule<T extends CommandType>(
plugin: (CommandPlugin<T> | EventPlugin<T>)[],
mod: ModuleNoPlugins[T],
): Module {
const onEvent = plugin.filter(isEventPlugin);
const plugins = plugin.filter(isCommandPlugin);
if (mod.type === CommandType.Autocomplete) {
throw new Error(
'You cannot use this function declaration for Autocomplete Interactions! use the raw object for options or' +
'sernAutoComplete function',
);
} else
return {
onEvent,
plugins,
...mod,
} as Module;
}
export function sernAutocomplete( export type EventModulePlugin<T extends EventType> =
onEvent: EventPlugin<CommandType.Autocomplete>[], | EventModuleEventPluginDefs[T]
mod: Omit<AutocompleteCommand, 'type' | 'name' | 'description' | 'onEvent'>, | EventModuleCommandPluginDefs[T];
): Omit<AutocompleteCommand, 'type' | 'name' | 'description'> {
return { export type CommandModulePlugin<T extends CommandType> = EventPlugin<T> | CommandPlugin<T>;
onEvent, //TODO: I WANT BETTER TYPINGS AHHHHHHHHHHHHHHH
...mod, // Maybe add overlaods
};
} /**
* User inputs this type. Sern processes behind the scenes for better usage
*/
export type InputCommandModule = {
[T in CommandType]: CommandModuleNoPlugins[T] & { plugins?: CommandModulePlugin<T>[] };
}[CommandType];
export type InputEventModule = {
[T in EventType]: EventModulesNoPlugins[T] & { plugins?: EventModulePlugin<T>[] };
}[EventType];

View File

@@ -1,35 +1,101 @@
import type { DiscordEvent, EventEmitterRegister } from '../types/handler';
import type Wrapper from './structures/wrapper'; import type Wrapper from './structures/wrapper';
import { fromEvent } from 'rxjs';
import { onReady } from './events/readyEvent'; import { onReady } from './events/readyEvent';
import { onMessageCreate } from './events/messageEvent'; import { onMessageCreate } from './events/messageEvent';
import { onInteractionCreate } from './events/interactionCreate'; import { onInteractionCreate } from './events/interactionCreate';
import { Err, Ok } from 'ts-results'; import { Err, Ok } from 'ts-results';
import { isDiscordEvent } from './utilities/predicates'; import { ExternalEventEmitters } from './utilities/readFile';
import type { Client } from 'discord.js'; import type { EventEmitter } from 'events';
import { processEvents } from './events/userDefinedEventsHandling';
import type { CommandModule, EventModule } from './structures/module';
import { EventType, PluginType } from './structures/enums';
import type {
CommandPlugin,
EventModuleCommandPluginDefs,
EventModuleEventPluginDefs,
EventPlugin,
InputCommandModule,
InputEventModule,
} from './plugins/plugin';
import { SernError } from './structures/errors';
/**
*
* @param wrapper options to pass into sern.
* Function to start the handler up.
*/
export function init(wrapper: Wrapper) { export function init(wrapper: Wrapper) {
const { events, client } = wrapper; const { events } = wrapper;
if (events !== undefined) { if (events !== undefined) {
eventObserver(client, events); processEvents(wrapper, events);
} }
onReady(wrapper); onReady(wrapper);
onMessageCreate(wrapper); onMessageCreate(wrapper);
onInteractionCreate(wrapper); onInteractionCreate(wrapper);
} }
function eventObserver(client: Client, events: (DiscordEvent | EventEmitterRegister)[]) { /**
events.forEach(event => { *
if (isDiscordEvent(event)) { * @param emitter Any external event emitter.
fromEvent(client, event[0], event[1]).subscribe(); * The object will be stored in a map, and then fetched by the name of the instance's class provided.
} else { * As there are infinite possibilities to adding external event emitters,
fromEvent(event[0], event[1], event[2]).subscribe(); * Most types aren't provided and are as narrow as possibly can.
} * @example
}); * ```
* Sern.addExternal(new Level())
* ```
* ```
* // events/level.ts
* export default eventModule({
* emitter: 'Level',
* type : EventType.External,
* name: 'error',
* execute(args) {
* console.log(args)
* }
* })
*
*/
export function addExternal<T extends EventEmitter>(emitter: T) {
if (ExternalEventEmitters.has(emitter.constructor.name)) {
throw Error(`${emitter.constructor.name} already exists!`);
}
ExternalEventEmitters.set(emitter.constructor.name, emitter);
} }
export const controller = { export const controller = {
next: () => Ok.EMPTY, next: () => Ok.EMPTY,
stop: () => Err.EMPTY, stop: () => Err.EMPTY,
}; };
export function commandModule(mod: InputCommandModule): CommandModule {
const onEvent: EventPlugin[] = [];
const plugins: CommandPlugin[] = [];
for (const pl of mod.plugins ?? []) {
if (pl.type === PluginType.Event) {
onEvent.push(pl);
} else {
plugins.push(pl as CommandPlugin);
}
}
return {
...mod,
onEvent,
plugins,
} as CommandModule;
}
export function eventModule(mod: InputEventModule): EventModule {
const onEvent: EventModuleEventPluginDefs[EventType][] = [];
const plugins: EventModuleCommandPluginDefs[EventType][] = [];
const hasPlugins = mod.plugins && mod.plugins.length > 0;
if (hasPlugins) {
throw Error(
SernError.NotSupportedYet + `: Plugins on event listeners are not supported yet`,
);
}
return {
...mod,
onEvent,
plugins,
} as EventModule;
}

View File

@@ -1,17 +1,7 @@
import { EventEmitter } from 'events'; import { EventEmitter } from 'events';
import type { Module } from './structures/module'; import type { SernEventsMapping } from '../types/handler';
type Payload = class SernEmitter extends EventEmitter {
| { success: true; module: Module }
| { success: false; module: Module | undefined; reason: string | Error };
type SernEventsMapping = {
['module.register']: [Payload];
['module.activate']: [Payload];
['error']: [Error | string];
};
export default class SernEmitter extends EventEmitter {
/** /**
* Listening to sern events with on. This event stays on until a crash or a normal exit * Listening to sern events with on. This event stays on until a crash or a normal exit
* @param eventName * @param eventName
@@ -46,3 +36,5 @@ export default class SernEmitter extends EventEmitter {
return super.emit(eventName, ...args); return super.emit(eventName, ...args);
} }
} }
export default SernEmitter;

View File

@@ -1,4 +1,4 @@
import type { APIGuildMember } from 'discord-api-types/v9'; import type { APIGuildMember } from 'discord-api-types/v10';
import type { import type {
ChatInputCommandInteraction, ChatInputCommandInteraction,
Client, Client,
@@ -14,6 +14,7 @@ import type {
import { None, Option, Some } from 'ts-results'; import { None, Option, Some } from 'ts-results';
import type { Nullish } from '../../types/handler'; import type { Nullish } from '../../types/handler';
import { ExternallyUsed } from '../utilities/externallyUsed'; import { ExternallyUsed } from '../utilities/externallyUsed';
import { SernError } from './errors';
function firstSome<T>(...args: Option<T>[]): Nullish<T> { function firstSome<T>(...args: Option<T>[]): Nullish<T> {
for (const op of args) { for (const op of args) {
@@ -43,7 +44,7 @@ export default class Context {
*/ */
@ExternallyUsed @ExternallyUsed
public get message() { public get message() {
return this.oMsg.unwrap(); return this.oMsg.expect(SernError.MismatchEvent);
} }
/** /**
* Getting the ChatInputCommandInteraction object. Crashes if module type is * Getting the ChatInputCommandInteraction object. Crashes if module type is
@@ -52,7 +53,7 @@ export default class Context {
*/ */
@ExternallyUsed @ExternallyUsed
public get interaction() { public get interaction() {
return this.oInterac.unwrap(); return this.oInterac.expect(SernError.MismatchEvent);
} }
@ExternallyUsed @ExternallyUsed
@@ -141,16 +142,19 @@ export default class Context {
public isEmpty() { public isEmpty() {
return this.oMsg.none && this.oInterac.none; return this.oMsg.none && this.oInterac.none;
} }
//Make queueable
//TODO: make this queueable
@ExternallyUsed @ExternallyUsed
public reply(content: Omit<InteractionReplyOptions, 'fetchReply'> | ReplyMessageOptions) { public reply(
content: string | Omit<InteractionReplyOptions, 'fetchReply'> | ReplyMessageOptions,
) {
return firstSome( return firstSome(
this.oInterac.map(i => { this.oInterac.map(i => {
return i.reply(content as InteractionReplyOptions).then(() => i.fetchReply()); return i
.reply(content as string | InteractionReplyOptions)
.then(() => i.fetchReply());
}), }),
this.oMsg.map(m => { this.oMsg.map(m => {
return m.reply(content as ReplyMessageOptions); return m.reply(content as string | ReplyMessageOptions);
}), }),
)!; )!;
} }

View File

@@ -2,15 +2,20 @@
* @enum { number }; * @enum { number };
*/ */
enum CommandType { enum CommandType {
Text = 0b00000001, Text = 0b00000000001,
Slash = 0b00000010, Slash = 0b00000000010,
MenuUser = 0b00000100,
MenuMsg = 0b00001000,
Button = 0b00010000,
MenuSelect = 0b00100000,
Modal = 0b01000000,
Autocomplete = 0b10000000,
Both = 0b0000011, Both = 0b0000011,
MenuUser = 0b00000000100,
MenuMsg = 0b0000001000,
Button = 0b00000010000,
MenuSelect = 0b00000100000,
Modal = 0b00001000000,
}
enum EventType {
Discord = 0b01,
Sern = 0b10,
External = 0b11,
} }
enum PluginType { enum PluginType {
@@ -18,4 +23,4 @@ enum PluginType {
Event = 0b10, Event = 0b10,
} }
export { CommandType, PluginType }; export { CommandType, PluginType, EventType };

View File

@@ -4,4 +4,6 @@ export enum SernError {
MismatchModule = `A module type mismatched with event emitted!`, MismatchModule = `A module type mismatched with event emitted!`,
NotSupportedInteraction = `This interaction is not supported.`, NotSupportedInteraction = `This interaction is not supported.`,
PluginFailure = `A plugin failed to call controller.next()`, PluginFailure = `A plugin failed to call controller.next()`,
MismatchEvent = `You cannot use message when an interaction fired or vice versa`,
NotSupportedYet = `This feature is not supported yet`,
} }

View File

@@ -0,0 +1,45 @@
import type { Override, SernEventsMapping } from '../../types/handler';
import type { BaseModule } from './module';
import type {
DiscordEmitterPlugin,
DiscordEventPlugin,
ExternalEmitterPlugin,
ExternalEventPlugin,
SernEmitterPlugin,
SernEventPlugin,
} from '../plugins/plugin';
import type { Awaitable, ClientEvents } from 'discord.js';
import type { EventType } from './enums';
export type SernEventCommand<T extends keyof SernEventsMapping = keyof SernEventsMapping> =
Override<
BaseModule,
{
name?: T;
type: EventType.Sern;
onEvent: SernEventPlugin[];
plugins: SernEmitterPlugin[];
execute(...args: SernEventsMapping[T]): Awaitable<void | unknown>;
}
>;
export type DiscordEventCommand<T extends keyof ClientEvents = keyof ClientEvents> = Override<
BaseModule,
{
name?: T;
type: EventType.Discord;
onEvent: DiscordEventPlugin[];
plugins: DiscordEmitterPlugin[];
execute(...args: ClientEvents[T]): Awaitable<void | unknown>;
}
>;
export type ExternalEventCommand = Override<
BaseModule,
{
emitter: string;
type: EventType.External;
onEvent: ExternalEventPlugin[];
plugins: ExternalEmitterPlugin[];
execute(...args: unknown[]): Awaitable<void | unknown>;
}
>;

View File

@@ -5,8 +5,10 @@ import type {
ApplicationCommandNonOptionsData, ApplicationCommandNonOptionsData,
ApplicationCommandNumericOptionData, ApplicationCommandNumericOptionData,
ApplicationCommandOptionData, ApplicationCommandOptionData,
ApplicationCommandOptionType,
ApplicationCommandSubCommandData, ApplicationCommandSubCommandData,
ApplicationCommandSubGroupData, ApplicationCommandSubGroupData,
AutocompleteInteraction,
Awaitable, Awaitable,
BaseApplicationCommandOptionsData, BaseApplicationCommandOptionsData,
ButtonInteraction, ButtonInteraction,
@@ -15,18 +17,17 @@ import type {
SelectMenuInteraction, SelectMenuInteraction,
UserContextMenuCommandInteraction, UserContextMenuCommandInteraction,
} from 'discord.js'; } from 'discord.js';
import type { Args, Override } from '../../types/handler'; import type { Args, Override, SlashOptions } from '../../types/handler';
import type { CommandPlugin, EventPlugin } from '../plugins/plugin'; import type { AutocompletePlugin, CommandPlugin, EventPlugin } from '../plugins/plugin';
import type Context from './context'; import type Context from './context';
import { CommandType, PluginType } from './enums'; import { CommandType, EventType, PluginType } from './enums';
import type { AutocompleteInteraction } from 'discord.js'; import type { DiscordEventCommand, ExternalEventCommand, SernEventCommand } from './events';
import type { ApplicationCommandOptionType } from 'discord.js';
export interface BaseModule { export interface BaseModule {
type: CommandType | PluginType; type: CommandType | PluginType;
name?: string; name?: string;
description: string; description?: string;
execute: (ctx: Context, args: Args) => Awaitable<void>; execute: (ctx: Context, args: Args) => Awaitable<void | unknown>;
} }
//possible refactoring types into interfaces and not types //possible refactoring types into interfaces and not types
@@ -34,9 +35,10 @@ export type TextCommand = Override<
BaseModule, BaseModule,
{ {
type: CommandType.Text; type: CommandType.Text;
onEvent: EventPlugin<CommandType.Text>[]; onEvent: EventPlugin<CommandType.Text>[]; //maybe allow BothPlugins for this also?
plugins: CommandPlugin[]; plugins: CommandPlugin[]; //maybe allow BothPlugins for this also?
alias?: string[]; alias?: string[];
execute: (ctx: Context, args: ['text', string[]]) => Awaitable<void | unknown>;
} }
>; >;
@@ -44,9 +46,10 @@ export type SlashCommand = Override<
BaseModule, BaseModule,
{ {
type: CommandType.Slash; type: CommandType.Slash;
onEvent: EventPlugin<CommandType.Slash>[]; onEvent: EventPlugin<CommandType.Slash>[]; //maybe allow BothPlugins for this also?
plugins: CommandPlugin[]; plugins: CommandPlugin[]; //maybe allow BothPlugins for this also?
options?: SernOptionsData[]; options?: SernOptionsData[];
execute: (ctx: Context, args: ['slash', SlashOptions]) => Awaitable<void | unknown>;
} }
>; >;
@@ -58,6 +61,7 @@ export type BothCommand = Override<
plugins: CommandPlugin[]; plugins: CommandPlugin[];
alias?: string[]; alias?: string[];
options?: SernOptionsData[]; options?: SernOptionsData[];
execute: (ctx: Context, args: Args) => Awaitable<void | unknown>;
} }
>; >;
@@ -67,7 +71,7 @@ export type ContextMenuUser = Override<
type: CommandType.MenuUser; type: CommandType.MenuUser;
onEvent: EventPlugin<CommandType.MenuUser>[]; onEvent: EventPlugin<CommandType.MenuUser>[];
plugins: CommandPlugin[]; plugins: CommandPlugin[];
execute: (ctx: UserContextMenuCommandInteraction) => Awaitable<void>; execute: (ctx: UserContextMenuCommandInteraction) => Awaitable<void | unknown>;
} }
>; >;
@@ -77,7 +81,7 @@ export type ContextMenuMsg = Override<
type: CommandType.MenuMsg; type: CommandType.MenuMsg;
onEvent: EventPlugin<CommandType.MenuMsg>[]; onEvent: EventPlugin<CommandType.MenuMsg>[];
plugins: CommandPlugin[]; plugins: CommandPlugin[];
execute: (ctx: MessageContextMenuCommandInteraction) => Awaitable<void>; execute: (ctx: MessageContextMenuCommandInteraction) => Awaitable<void | unknown>;
} }
>; >;
@@ -87,7 +91,7 @@ export type ButtonCommand = Override<
type: CommandType.Button; type: CommandType.Button;
onEvent: EventPlugin<CommandType.Button>[]; onEvent: EventPlugin<CommandType.Button>[];
plugins: CommandPlugin[]; plugins: CommandPlugin[];
execute: (ctx: ButtonInteraction) => Awaitable<void>; execute: (ctx: ButtonInteraction) => Awaitable<void | unknown>;
} }
>; >;
@@ -97,7 +101,7 @@ export type SelectMenuCommand = Override<
type: CommandType.MenuSelect; type: CommandType.MenuSelect;
onEvent: EventPlugin<CommandType.MenuSelect>[]; onEvent: EventPlugin<CommandType.MenuSelect>[];
plugins: CommandPlugin[]; plugins: CommandPlugin[];
execute: (ctx: SelectMenuInteraction) => Awaitable<void>; execute: (ctx: SelectMenuInteraction) => Awaitable<void | unknown>;
} }
>; >;
@@ -107,7 +111,7 @@ export type ModalSubmitCommand = Override<
type: CommandType.Modal; type: CommandType.Modal;
onEvent: EventPlugin<CommandType.Modal>[]; onEvent: EventPlugin<CommandType.Modal>[];
plugins: CommandPlugin[]; plugins: CommandPlugin[];
execute: (ctx: ModalSubmitInteraction) => Awaitable<void>; execute: (ctx: ModalSubmitInteraction) => Awaitable<void | unknown>;
} }
>; >;
@@ -118,14 +122,15 @@ export type ModalSubmitCommand = Override<
export type AutocompleteCommand = Override< export type AutocompleteCommand = Override<
BaseModule, BaseModule,
{ {
type: CommandType.Autocomplete; name?: never;
name: string; description?: never;
onEvent: EventPlugin<CommandType.Autocomplete>[]; type?: never;
execute: (ctx: AutocompleteInteraction) => Awaitable<void>; onEvent: AutocompletePlugin[];
execute: (ctx: AutocompleteInteraction) => Awaitable<void | unknown>;
} }
>; >;
export type EventModule = DiscordEventCommand | SernEventCommand | ExternalEventCommand;
export type Module = export type CommandModule =
| TextCommand | TextCommand
| SlashCommand | SlashCommand
| BothCommand | BothCommand
@@ -133,12 +138,13 @@ export type Module =
| ContextMenuMsg | ContextMenuMsg
| ButtonCommand | ButtonCommand
| SelectMenuCommand | SelectMenuCommand
| ModalSubmitCommand | ModalSubmitCommand;
| AutocompleteCommand;
export type Module = CommandModule | EventModule;
//https://stackoverflow.com/questions/64092736/alternative-to-switch-statement-for-typescript-discriminated-union //https://stackoverflow.com/questions/64092736/alternative-to-switch-statement-for-typescript-discriminated-union
// Explicit Module Definitions for mapping // Explicit Module Definitions for mapping
export type ModuleDefs = { export type CommandModuleDefs = {
[CommandType.Text]: TextCommand; [CommandType.Text]: TextCommand;
[CommandType.Slash]: SlashCommand; [CommandType.Slash]: SlashCommand;
[CommandType.Both]: BothCommand; [CommandType.Both]: BothCommand;
@@ -147,7 +153,12 @@ export type ModuleDefs = {
[CommandType.Button]: ButtonCommand; [CommandType.Button]: ButtonCommand;
[CommandType.MenuSelect]: SelectMenuCommand; [CommandType.MenuSelect]: SelectMenuCommand;
[CommandType.Modal]: ModalSubmitCommand; [CommandType.Modal]: ModalSubmitCommand;
[CommandType.Autocomplete]: AutocompleteCommand; };
export type EventModuleDefs = {
[EventType.Sern]: SernEventCommand;
[EventType.Discord]: DiscordEventCommand;
[EventType.External]: ExternalEventCommand;
}; };
//TODO: support deeply nested Autocomplete //TODO: support deeply nested Autocomplete
@@ -162,7 +173,7 @@ export type SernAutocompleteData = Override<
| ApplicationCommandOptionType.String | ApplicationCommandOptionType.String
| ApplicationCommandOptionType.Number | ApplicationCommandOptionType.Number
| ApplicationCommandOptionType.Integer; | ApplicationCommandOptionType.Integer;
command: Omit<AutocompleteCommand, 'type' | 'name' | 'description'>; command: AutocompleteCommand;
} }
>; >;

View File

@@ -1,11 +1,12 @@
import type { Client } from 'discord.js'; import type { Client } from 'discord.js';
import type { DiscordEvent, EventEmitterRegister } from '../../types/handler';
import type SernEmitter from '../sernEmitter'; import type SernEmitter from '../sernEmitter';
import type { EventModule } from './module';
/** /**
* An object to be passed into Sern.Handler constructor. * An object to be passed into Sern.Handler constructor.
* @typedef {object} Wrapper * @typedef {object} Wrapper
* @property {readonly Client} client * @property {readonly Client} client
* @prop { readonly SernEmitter } sernEmitter
* @property {readonly string} defaultPrefix * @property {readonly string} defaultPrefix
* @property {readonly string} commands * @property {readonly string} commands
* @prop { readonly DiscordEvent[] } events * @prop { readonly DiscordEvent[] } events
@@ -15,7 +16,10 @@ interface Wrapper {
readonly sernEmitter?: SernEmitter; readonly sernEmitter?: SernEmitter;
readonly defaultPrefix?: string; readonly defaultPrefix?: string;
readonly commands: string; readonly commands: string;
readonly events?: (DiscordEvent | EventEmitterRegister)[]; readonly events?:
| string
| { mod: EventModule; absPath: string }[]
| (() => { mod: EventModule; absPath: string }[]);
} }
export default Wrapper; export default Wrapper;

View File

@@ -0,0 +1,9 @@
import type { Awaitable } from 'discord.js';
export async function asyncResolveArray<T>(promiseLike: Awaitable<T>[]): Promise<T[]> {
const arr: T[] = [];
for await (const el of promiseLike) {
arr.push(el);
}
return arr;
}

View File

@@ -1,28 +1,5 @@
import type { Message } from 'discord.js'; import type { Message } from 'discord.js';
/**
* Checks if the author of message is a bot or not
* @param message The message to check
* @returns `true` if the author of the message is a bot, `false` otherwise
* @example
* isBot(message) ? 'yes it is a bot' : 'no it is not a bot';
*/
export function isNotFromBot(message: Message) {
return !message.author.bot;
}
/**
* Checks if the message **starts** with the prefix
* @param message The message to check
* @param prefix The prefix to check for
* @returns `true` if the message starts with the prefix, `false` otherwise
* @example
* hasPrefix(message, '!') ? 'yes it does' : 'no it does not';
*/
export function hasPrefix(message: Message, prefix?: string) {
return message.content.startsWith(prefix!);
}
/** /**
* Removes the first character(s) _[depending on prefix length]_ of the message * Removes the first character(s) _[depending on prefix length]_ of the message
* @param msg * @param msg

View File

@@ -1,4 +1,4 @@
import type { Module, ModuleDefs } from '../structures/module'; import type { CommandModuleDefs, EventModule, Module } from '../structures/module';
import type { import type {
Awaitable, Awaitable,
ButtonInteraction, ButtonInteraction,
@@ -9,12 +9,23 @@ import type {
SelectMenuInteraction, SelectMenuInteraction,
UserContextMenuCommandInteraction, UserContextMenuCommandInteraction,
} from 'discord.js'; } from 'discord.js';
import type { DiscordEvent, EventEmitterRegister } from '../..'; import {
AutocompleteInteraction,
Interaction,
InteractionType,
ModalSubmitInteraction,
} from 'discord.js';
import type {
DiscordEventCommand,
ExternalEventCommand,
SernEventCommand,
} from '../structures/events';
import { EventType } from '../..';
export function correctModuleType<T extends keyof ModuleDefs>( export function correctModuleType<T extends keyof CommandModuleDefs>(
plug: Module | undefined, plug: Module | undefined,
type: T, type: T,
): plug is ModuleDefs[T] { ): plug is CommandModuleDefs[T] {
// Another way to check if type is equivalent, // Another way to check if type is equivalent,
// It will check based on flag system instead // It will check based on flag system instead
return plug !== undefined && (plug.type & type) !== 0; return plug !== undefined && (plug.type & type) !== 0;
@@ -44,11 +55,46 @@ export function isUserContextMenuCmd(
return i.isUserContextMenuCommand(); return i.isUserContextMenuCommand();
} }
export function isPromise<T>(promiseLike: Awaitable<T>): promiseLike is Promise<T> { export function isApplicationCommand(interaction: Interaction): interaction is CommandInteraction {
return interaction.type === InteractionType.ApplicationCommand;
}
export function isModalSubmit(interaction: Interaction): interaction is ModalSubmitInteraction {
return interaction.type === InteractionType.ModalSubmit;
}
export function isAutocomplete(interaction: Interaction): interaction is AutocompleteInteraction {
return interaction.type === InteractionType.ApplicationCommandAutocomplete;
}
export function isMessageComponent(
interaction: Interaction,
): interaction is MessageComponentInteraction {
return interaction.type === InteractionType.MessageComponent;
}
export function isPromise<T>(promiseLike: Awaitable<T>): promiseLike is PromiseLike<T> {
const keys = new Set(Object.keys(promiseLike)); const keys = new Set(Object.keys(promiseLike));
return keys.has('then') && keys.has('catch'); return keys.has('then') && keys.has('catch');
} }
export function isDiscordEvent(el: DiscordEvent | EventEmitterRegister): el is DiscordEvent { export function isDiscordEvent(el: EventModule): el is DiscordEventCommand {
return el.length === 2; return el.type === EventType.Discord;
} }
export function isSernEvent(el: EventModule): el is SernEventCommand {
return el.type === EventType.Sern;
}
export function isExternalEvent(el: EventModule): el is ExternalEventCommand {
return el.type === EventType.External && 'emitter' in el;
}
// export function isEventPlugin<T extends CommandType>(
// e: CommandModulePlugin<T>,
// ): e is EventPlugin<T> {
// return e.type === PluginType.Event;
// }
// export function isCommandPlugin<T extends CommandType>(
// e: CommandModulePlugin<T>,
// ): e is CommandPlugin<T> {
// return !isEventPlugin(e);
// }

View File

@@ -3,6 +3,10 @@ import { readdirSync, statSync } from 'fs';
import { join } from 'path'; import { join } from 'path';
import { from, Observable } from 'rxjs'; import { from, Observable } from 'rxjs';
import type { Module } from '../structures/module'; import type { Module } from '../structures/module';
import { SernError } from '../structures/errors';
import type { Result } from 'ts-results';
import { Err, Ok } from 'ts-results';
import type { EventEmitter } from 'events';
//Maybe move this? this probably doesnt belong in utlities/ //Maybe move this? this probably doesnt belong in utlities/
export const BothCommands = new Map<string, Module>(); export const BothCommands = new Map<string, Module>();
@@ -22,6 +26,11 @@ export const TextCommands = {
aliases: new Map<string, Module>(), aliases: new Map<string, Module>(),
}; };
export const ModalSubmitCommands = new Map<string, Module>(); export const ModalSubmitCommands = new Map<string, Module>();
/**
* keeps all external emitters stored here
*/
export const ExternalEventEmitters = new Map<string, EventEmitter>();
// Courtesy @Townsy45 // Courtesy @Townsy45
function readPath(dir: string, arrayOfFiles: string[] = []): string[] { function readPath(dir: string, arrayOfFiles: string[] = []): string[] {
try { try {
@@ -45,15 +54,22 @@ export const fmtFileName = (n: string) => n.substring(0, n.length - 3);
* @param commandDir * @param commandDir
*/ */
export function buildData(commandDir: string): Observable<{ export function buildData<T>(commandDir: string): Observable<
mod: Module; Result<
absPath: string; {
}> { mod: T;
absPath: string;
},
SernError
>
> {
return from( return from(
getCommands(commandDir).map(absPath => { getCommands(commandDir).map(absPath => {
// eslint-disable-next-line @typescript-eslint/no-var-requires // eslint-disable-next-line @typescript-eslint/no-var-requires
const mod = <Module>require(absPath).default; const mod = <T | undefined>require(absPath).default;
return { mod, absPath }; if (mod !== undefined) {
return Ok({ mod, absPath });
} else return Err(SernError.UndefinedModule);
}), }),
); );
} }

View File

@@ -1,4 +1,7 @@
import SernEmitter from './handler/sernEmitter';
export { eventModule, commandModule } from './handler/sern';
export * as Sern from './handler/sern'; export * as Sern from './handler/sern';
export * from './types/handler'; export * from './types/handler';
export * from './handler/structures/structxports'; export * from './handler/structures/structxports';
export * from './handler/plugins/plugin'; export * from './handler/plugins/plugin';
export { SernEmitter };

View File

@@ -1,5 +1,5 @@
import type { Awaitable, ClientEvents, CommandInteractionOptionResolver } from 'discord.js'; import type { CommandInteractionOptionResolver } from 'discord.js';
import type { EventEmitter } from 'events'; import type { CommandModule, EventModule, Module } from '../handler/structures/module';
export type Nullish<T> = T | undefined | null; export type Nullish<T> = T | undefined | null;
// Thanks to @kelsny // Thanks to @kelsny
@@ -9,21 +9,16 @@ export type ParseType<T> = {
export type Args = ParseType<{ text: string[]; slash: SlashOptions }>; export type Args = ParseType<{ text: string[]; slash: SlashOptions }>;
export type DiscordEvent = ParseType<{
[K in keyof ClientEvents]: (...args: ClientEvents[K]) => Awaitable<void>;
}>;
export type EventEmitterRegister = [
emitter: EventEmitter,
k: string,
cb: (...args: unknown[]) => Awaitable<void>,
];
export type SlashOptions = Omit<CommandInteractionOptionResolver, 'getMessage' | 'getFocused'>; export type SlashOptions = Omit<CommandInteractionOptionResolver, 'getMessage' | 'getFocused'>;
// Source: https://dev.to/vborodulin/ts-how-to-override-properties-with-type-intersection-554l // Source: https://dev.to/vborodulin/ts-how-to-override-properties-with-type-intersection-554l
export type Override<T1, T2> = Omit<T1, keyof T2> & T2; export type Override<T1, T2> = Omit<T1, keyof T2> & T2;
export type DefinitelyDefined<T, K> = T & Override<T, K>; export type DefinitelyDefined<T, K extends keyof T = keyof T> = {
[L in K]-?: T[L] extends Record<string, unknown>
? DefinitelyDefined<T[L], keyof T[L]>
: Required<T>[L];
} & T;
type Reconstruct<T> = T extends Omit<infer O, infer _> ? O & Reconstruct<O> : T; type Reconstruct<T> = T extends Omit<infer O, infer _> ? O & Reconstruct<O> : T;
@@ -31,8 +26,26 @@ type IsOptional<T> = {
[K in keyof T]-?: T[K] extends Required<T>[K] ? false : true; [K in keyof T]-?: T[K] extends Required<T>[K] ? false : true;
}; };
export type UnionToIntersection<T> = (T extends unknown ? (x: T) => unknown : never) extends ( /**
x: infer R, * Turns a function with a union of array of args into a single union
) => unknown * [ T , V , B ] | [ A ] => T | V | B | A
? R */
: never; export type SpreadParams<T extends (...args: any) => unknown> = (
args: Parameters<T>[number],
) => unknown;
/**
* After modules are transformed, name and description are given default values if none
* are provided to Module. This type represents that transformation
*/
export type DefinedModule = DefinitelyDefined<Module, 'name' | 'description'>;
export type DefinedCommandModule = DefinitelyDefined<CommandModule, 'name' | 'description'>;
export type DefinedEventModule = DefinitelyDefined<EventModule, 'name' | 'description'>;
export type Payload =
| { type: 'success'; module: Module }
| { type: 'failure'; module: Module | undefined; reason: string | Error };
export type SernEventsMapping = {
['module.register']: [Payload];
['module.activate']: [Payload];
['error']: [Error | string];
};

View File

@@ -1,13 +0,0 @@
import { fmt, hasPrefix, isNotFromBot } from '../src/handler/utilities/messageHelpers';
describe('FUNCTIONS', () => {
test('If hasPrefix is a function', () => {
expect(typeof hasPrefix).toBe('function');
});
test('if fmt is a function', () => {
expect(typeof fmt).toBe('function');
});
test('if isBot is a function', () => {
expect(typeof isNotFromBot).toBe('function');
});
});

View File

@@ -16,6 +16,6 @@
"declaration": true, "declaration": true,
"forceConsistentCasingInFileNames": true, "forceConsistentCasingInFileNames": true,
}, },
"exclude": ["node_modules", "tests", "dist"], "exclude": ["node_modules", "dist"],
"include": ["src"], "include": ["src"],
} }