feat adding guide to repo, adding api

This commit is contained in:
Jacob Nguyen
2022-08-07 16:42:55 -05:00
parent e0444a9998
commit fc3dde72f9
33 changed files with 32 additions and 81 deletions

View File

@@ -11395,7 +11395,7 @@ section {
.device[data-device=iPhoneX][data-orientation=portrait][data-color=black]::after {
content: "";
background-image: url("../assets/img/portrait_black.png");
background-image: url("../assets/images/portrait_black.png");
}
.device[data-device=iPhoneX][data-orientation=portrait][data-color=black] .button {

View File

@@ -22,5 +22,5 @@ Welcome to sern's official guide. This guide will go through all the core featur
* [Your first event](walkthrough/first-event.md)
### Good to know
[//]: <> (Maybe redirect to the sern.config.json section in future)
[//]: (Maybe redirect to the sern.config.json section in future)
* [sern.config.json](walkthrough/good-to-know.md)

View File

@@ -1,17 +1,17 @@
# CLI
Setting up the [CLI](https://github.com/sern-handler/cli) is easy. <br>
Setting up the [CLI](https://github.com/sern-handler/cli) is easy. <br />
- To start a brand new project, run :
```
sern init (-y)
```
Include the `-y` flag if you want to set up defaults. The default langauge is [Typescript](https://www.typescriptlang.org/) <br>
Include the `-y` flag if you want to set up defaults. The default langauge is [Typescript](https://www.typescriptlang.org/) <br />
- To install [plugins](plugins.md) maintained by the community [repository](https://github.com/sern-handler/awesome-plugins),
```
sern plugins
```
This will display a menu selection of all installable plugins. <br>
This will display a menu selection of all installable plugins. <br />
**Note**: You must have a [sern.config.json](good-to-know.md) to use this command.
If you want to view plugins, visit the repository linked above.

View File

@@ -32,11 +32,12 @@ exports.default = commandModule({
```
To view what each of these properties mean in depth, visit the [official documentation](https://sern-handler.js.org/docs).
### Types of command modules
Every command module `type` is part of an enum. This field allows type inference for the rest of a module's fields. <br>
Every command module `type` is part of an enum. This field allows type inference for the rest of a module's fields. <br />
All the command types can be found in the [official documentation](https://sern-handler.js.org/docs)!
<p>So, lets say you want to make a command module that listens to modals. </p>
**Note**: Keep in mind you'll need to send a modal with a custom id `dm-me`. This example below is the response to a modal being sent.<br>
**Note**: Keep in mind you'll need to send a modal with a custom id `dm-me`. This example below is the response to a modal being sent.
<br />
Typescript:
```typescript

View File

@@ -1,5 +1,5 @@
# Your first event module
We will dissect a basic event module. <br>
We will dissect a basic event module. <br/ >
Typescript:
```typescript
export default eventModule({
@@ -27,7 +27,7 @@ can be found [here](https://sern-handler.js.org/docs).
To view what each of these properties mean in depth, visit the [official documentation](https://sern-handler.js.org/docs).
<br>
<br />
Event modules are laid out similarly to command modules. These listen to any and all event you provide.
In the current version 1.1.0-beta, plugins are not supported.
@@ -47,6 +47,7 @@ export default eventModule({
Javascript:
```typescript
exports.default = eventModule({
type: EventType.Discord,
plugins : [], //NOT SUPPORTED YET!!

View File

@@ -36,11 +36,11 @@ export function serenOnly() {
}
```
<br> As part of sern's extensibility, the plugins feature make sern just as powerful, if not more powerful than
<br /> As part of our extensibility, the plugins feature make sern just as powerful, if not more powerful than
standard handlers.
Plugins modify and add new behavior to standard modules, extending customizability and implementing automation.
<br> At the moment, there are two types of plugins:
<br /> At the moment, there are two types of plugins:
- Command Plugins
- Event Plugins
@@ -55,8 +55,8 @@ export interface Controller {
stop: () => Err<void>;
}
```
An instance of the above object is passed into every plugin. <br>
This controls whether a module is stored into sern. <br>
An instance of the above object is passed into every plugin. <br />
This controls whether a module is stored into sern. <br />
Typescript:
```typescript
export function inDir(dir : string) : CommandPlugin<CommandType.Both> {
@@ -89,18 +89,18 @@ export function inDir(dir : string) {
}
}
```
Above, this simple plugin logs that the module has been loaded along with a timestamp. <br>
Above, this simple plugin logs that the module has been loaded along with a timestamp. <br />
Again, it is up to **you** to define plugin logic! The possibilities to customize your bots is endless.
## Event Plugins
![event-plugins](/assets/images/eventplugins.drawio.svg) <br>
![event-plugins](../../../assets/images/eventplugins.drawio.svg) <br />
- An event is emitted by discord.js.
- This event is passed to all plugins (**in order!!**),
- If all are successful,
The command is executed. Calling `controller.stop()` notifies sern that this command should not be run,
and this event is ignored.
<br> <br>
<br /> <br />
This flexible structure allows you to write reusable preconditions, permissions verifiers,
argument verifiers, and much more.

View File

@@ -4,4 +4,4 @@ You're shipped with the SernEmitter. This EventEmitter listens to
- command modules registered and its status, the `module.register` event
- any errors that are recoverable, the `error` event
<br> You can put these and other event listeners into event modules!
<br /> You can put these and other event listeners into event modules!

5
docs/intro.md Normal file
View File

@@ -0,0 +1,5 @@
---
sidebar_position: 1
---
# insert handler readme

View File

@@ -127,8 +127,9 @@ const config = {
[
'docusaurus-plugin-typedoc',
{
entryPoints: ['../sernHandlerV2/src/index.ts'],
tsconfig: '../sernHandlerV2/tsconfig-base.json',
//if you're editing website, please change this to your local branch of sern to generate documentation
entryPoints: ['C:\\Users\\jacob\\OneDrive\\Desktop\\Projects\\sern\\sernHandlerV2\\src\\index.ts'],
tsconfig: 'C:\\Users\\jacob\\OneDrive\\Desktop\\Projects\\sern\\sernHandlerV2\\tsconfig-esm.json',
},
]
]

View File

View File

View File

@@ -1,9 +0,0 @@
# Choosing an IDE
Choosing an IDE is a matter of personal preference. The following are some
suggestions for choosing an IDE:
* [Visual Studio Code](https://code.visualstudio.com)
* [Sublime Text](https://www.sublimetext.com/)
* [NotePad++](https://notepad-plus-plus.org/)

View File

@@ -1,10 +0,0 @@
Tell the users how to prepare to code.
like installing node & npm & etc.
(this is for the user who never coded before)
# Preparing to Code
After installing and IDE you need to insall node.
You can download the LTS version of node right [here](https://nodejs.org/en/download/release/latest/)

View File

@@ -1 +0,0 @@
😈 Kill sapphire

View File

@@ -1,17 +0,0 @@
# Giriş
Sern'ün resmi kılavuzuna hoşgeldiniz. Bu kılavuz size Sern'ü anlamanızda ve kullanmanızda yardımcı olacak.
### Ne öğreneceğim?
* Discord.js v14 basit bir bot yapmayı,
* Sern'ü komut satır arayüzü (CLI) ile kullanmayı,
* Sern'ün kullanımının kolaylıklarını,
### Ek Başlıklar
* Biz kimiz?
* Proje Hakkında
* Sern vs Sapphire
Eğer hazırsan başlayalım 🥳🥰

View File

@@ -1,9 +0,0 @@
# Choosing an IDE
Choosing an IDE is a matter of personal preference. The following are some
suggestions for choosing an IDE:
* [Visual Studio Code](https://code.visualstudio.com)
* [Sublime Text](https://www.sublimetext.com/)
* [NotePad++](https://notepad-plus-plus.org/)

View File

@@ -1,10 +0,0 @@
Tell the users how to prepare to code.
like installing node & npm & etc.
(this is for the user who never coded before)
# Preparing to Code
After installing and IDE you need to insall node.
You can download the LTS version of node right [here](https://nodejs.org/en/download/release/latest/)

View File

@@ -1 +0,0 @@
😈 Kill sapphire

View File

@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html>
<html lang="en">
<head>
<title>Sern - Handlers. Redefined.</title>
@@ -24,8 +24,8 @@
<div class="container">
<a href="#" class="navbar-brand">
<img src="assets/images/logo.png" width="42" height="40" alt="" class="d-inline-block align-middle mr-2">
<span class="text font-weight-bold font-family-ubuntu hover-zoom">SernHandler</span>
<span>7 <i class="bi bi-star-fill padding-7px"></i>270 <i class="bi bi-arrow-bar-down"></i></span>
<span class="text font-weight-bold font-family-ubuntu hover-zoom">SernHandler</span>
<span>7 <i class="bi bi-star-fill padding-7px"></i>270 <i class="bi bi-arrow-bar-down"></i></span>
</a>
<button type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation" class="navbar-toggler"><span class="navbar-toggler-icon"></span></button>
@@ -49,7 +49,7 @@
<h1 class="display-1 lh-1 mb-3 fw-bold text-bold">Handlers. Redefined.</h1>
<p class="lead fw-normal text-muted mb-5 text-align-left">With the support of the community made plugins and powerful CLI, it's more than just a handler.</p>
<div class="d-flex flex-column flex-lg-row align-items-center">
<img class="app-badge" src="assets/images/R.png" alt="..." /><p class="fw-bold font-family-ubuntu text ml-2 mt-3 qi">npm install @sern/handler</p>
<img class="app-badge" src="assets/images/R.png" alt="..." /><p class="fw-bold font-family-ubuntu text ml-2 mt-3 qi">npm install @sern/handler</p>
</div>
</div>
</div>

View File

@@ -14,7 +14,7 @@
"serve": "docusaurus serve",
"write-translations": "docusaurus write-translations",
"write-heading-ids": "docusaurus write-heading-ids",
"typedoc-json": "typedoc --json ../sern-community/docs.json --pretty --entryPoints ../sernHandlerV2/src/index.ts --tsconfig ../sernHandlerV2/tsconfig-base.json --excludeExternals"
"typedoc-json": "typedoc --json ../sern-community/docs.json --pretty --entryPoints ../sernHandlerV2/src/index.ts --tsconfig ../sernHandlerV2/tsconfig-esm.json --excludeExternals"
},
"dependencies": {
"@docusaurus/core": "2.0.0-rc.1",