Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(*): Revamp Handler #34

Closed
wants to merge 139 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
139 commits
Select commit Hold shift + click to select a range
cfb7df8
feat(sern.ts) attempting to remove the bloated class in favor of smaller
jacoobes Mar 8, 2022
84fc853
refactor(handler) change init param to Wrapper, add eventConfig type
jacoobes Mar 8, 2022
0dd95be
feat(sern.ts) Add basic event manager
jacoobes Mar 8, 2022
9ce1314
docs(wrapper.ts) Add events property to JSDoc
jacoobes Mar 9, 2022
08f5937
feat(handler) new ready event handling
jacoobes Mar 9, 2022
df626e0
feat(events) Moving default events to its own folder for organization
jacoobes Mar 9, 2022
10aee77
feat(handler) begin message event and wrapper.prefix =
jacoobes Mar 11, 2022
6d2af47
feat(handler) Filters only executable messages now
jacoobes Mar 11, 2022
cdd8fce
refactor(sern.ts) Slowly change handler class to init function
jacoobes Mar 11, 2022
0513391
build(logger.ts) Remove day.js dependency in favor of native
jacoobes Mar 11, 2022
30b7f59
feat(module.ts) Removing and minimizing module. Will allow simplication
jacoobes Mar 11, 2022
f1ffff4
feat(command.ts) Add command class
jacoobes Mar 11, 2022
ecf7ecc
feat(handler) finish loading command functionality, adjust properties
jacoobes Mar 11, 2022
840619d
feat(command.ts) throw error on alias present on slash command
jacoobes Mar 12, 2022
5b968ce
feat(handler) create command-options interface, remove module
jacoobes Mar 13, 2022
586d386
refactor(command.ts) properties no longer look as ugly
jacoobes Mar 13, 2022
5a1870b
feat : refactor command objects. Deciding not to use a class
jacoobes Mar 14, 2022
3178f18
feat (handler) moving to dev build; new module types
jacoobes Mar 15, 2022
4102c71
feat(commands) create module handler to deal with incoming data
jacoobes Mar 16, 2022
5b53d42
feat : update module loader for extensibility
jacoobes Mar 16, 2022
2ea3558
feat (handler) more progress on message handler
jacoobes Mar 17, 2022
1ad429f
feat : finish basic message event handler
jacoobes Mar 17, 2022
99aae7d
feat(handler) added module type checking and started interactions han…
jacoobes Mar 20, 2022
05fadf0
feat : remove parse option, allowing user to custom parse arguments
jacoobes Mar 21, 2022
5baff09
feat(types) added util type Override
jacoobes Mar 21, 2022
d34c188
feat(handler) add basic interaction handling and add error for not
jacoobes Mar 22, 2022
a227f1a
feat(interactionCreate.ts) finish basic interaction handling for chat…
jacoobes Mar 22, 2022
44e6e58
feat(handler) improving context api
jacoobes Mar 23, 2022
2191fda
refactor : modify module typings to override
jacoobes Mar 23, 2022
c002c27
refactor : exports now simplified, removed default arg parsers as parse
jacoobes Mar 26, 2022
cf708b6
fix(structxports) forgot to export top level types
jacoobes Mar 26, 2022
f8c5bfc
fix(structxports) added top lvl module type
jacoobes Mar 26, 2022
b0d4f96
feat : add typings for ctx menus
jacoobes Mar 26, 2022
b326a91
feat(interactionCreate) add basic context menu handling
jacoobes Mar 29, 2022
145fcb3
refactor(context.ts) clean up context constructing
jacoobes Mar 29, 2022
26c2022
fix(context.ts) fixed bug on type constraints
jacoobes Mar 29, 2022
2d715ca
feat(interactionHandling) make code more dry with op fn filterTap
jacoobes Mar 29, 2022
bd2004b
fix(messageEvent) made messageEvent more linear and make more
jacoobes Mar 29, 2022
4671fac
fix(errors.ts) syntax error enum fix
jacoobes Mar 29, 2022
1b7c465
feat(handler) context class updates and more minor additions
jacoobes Apr 3, 2022
bc0d1ce
refactor(context.ts) name changes for easier dev usages
jacoobes Apr 3, 2022
ea8c159
feat(handler) Add context more context methods and nullish type
jacoobes Apr 3, 2022
0ea470d
refactor(context.ts) Obeying ts naming conventions :(
jacoobes Apr 3, 2022
930c2ca
refactor(context.ts) Oops forgot .map existed.... Much easier code to
jacoobes Apr 3, 2022
4ef0b87
feat(handler) Add button and select menu support!
jacoobes Apr 3, 2022
ef8e396
feat(handler) run formatter and made message prefixes case insensitive
jacoobes Apr 3, 2022
e4e4aca
fix(readyEvent) filtered opposite
jacoobes Apr 3, 2022
ecf07fe
feat(readyEvent) refactor and simplify readyEvent
jacoobes Apr 4, 2022
e21508c
feat(handler) moving and organizing files, refactor context api
jacoobes Apr 4, 2022
490d640
refactor : change naming conventions to PascalCase
jacoobes Apr 8, 2022
8866bff
feat : plugin development and ensuring all module objs have name
jacoobes Apr 9, 2022
136b0d2
feat : plugin api improvements, declarative ui
jacoobes Apr 9, 2022
2dd4183
feat : can register plugin modules now
jacoobes Apr 10, 2022
de7ddc3
feat : more plugin work ( currently not finsihed), removed init function
jacoobes Apr 11, 2022
f213e88
feat(handler) more plugin work, refactoring rxjs pipes
jacoobes Apr 13, 2022
4e1a806
feat(handler) : refactored ready event and finished loading command
jacoobes Apr 16, 2022
70bd12d
feat(handler): command plugins work?!
jacoobes Apr 16, 2022
eeabecb
feat(handler) : More work toward event plugins, added typings for it
jacoobes Apr 19, 2022
86c4e45
feat(observableHandling) : making match function a type predicate
jacoobes Apr 19, 2022
8bc624a
feat(messageEvent) : more refactoring to enable plugin usage
jacoobes Apr 19, 2022
b963f51
refactor(messageEvent) : cleaning up observables
jacoobes Apr 19, 2022
f6b88dc
feat(prefix): make defaultPrefix optional
EvolutionX-10 Apr 20, 2022
4d06009
chore: handle no prefix case
EvolutionX-10 Apr 20, 2022
f2e3a14
chore: apply the requested changes
EvolutionX-10 Apr 20, 2022
fc08ae4
fix(readyEvent) : module loading not correctly.
jacoobes Apr 21, 2022
3e0a5b3
fix(handler) : turning readFiles to observable; refactor readyevent
jacoobes Apr 21, 2022
901cb51
fix(readyEvent, partition) both were broken and failed to load plugin…
jacoobes Apr 22, 2022
02956a0
feat(handler) basic event plugin support
jacoobes Apr 23, 2022
5b82d5f
build(package.json) change to alpha build
jacoobes Apr 23, 2022
9e05090
feat : partitioning command stores for better event mapping, more
jacoobes Apr 29, 2022
2c8fdce
fix(messageEvent) : fix access location for messages
jacoobes Apr 29, 2022
4448d5a
feat : strict commandType checking transition for ergonomics
jacoobes Apr 29, 2022
2f61399
feat(handler): progress on event plugins
jacoobes May 7, 2022
57dc0ba
build : Added ts-pattern for pattern matching with command types and
jacoobes May 8, 2022
d3e8943
refactor: change from switch -> match
jacoobes May 8, 2022
97867d9
build: moving eslint and prettier dependencies
jacoobes May 8, 2022
8782cad
fix: accidentally imported wildcard from wrong place & namespace
jacoobes May 9, 2022
46b3b95
chore: eslint formattting
jacoobes May 9, 2022
99a5a3c
chore: cleanup code and delete unused files
jacoobes May 10, 2022
6462b4c
build: add .idea to gitignore
jacoobes May 11, 2022
88dcdee
feat: broadening EventPlugin default generic type, reformat with pret…
May 13, 2022
3dedba3
chore: prettier reformat
May 13, 2022
c4e8e51
feat: interactionCreate.ts refactoring
May 14, 2022
f5d02ae
refactor: Remove duplicate type alias in resolveParameters.ts
May 14, 2022
6ac9720
feat: Adding TextInput map & starting event plugins for message compo…
May 14, 2022
d29298c
feat: Add messageComponent handler
May 14, 2022
2697e35
feat: Add castings for res
May 14, 2022
58b7a6c
refactor: shorten code, add UnionToTuple type
jacoobes May 15, 2022
86457a7
refactor: Change sernModule fn signature
jacoobes May 15, 2022
61fe853
refactor: Adding more top level imports and move partition
jacoobes May 15, 2022
b6bf08f
refactor: Remove PluggedModule, change Module signature to support ev…
jacoobes May 15, 2022
df1808c
style: Reformat w/ prettier
jacoobes May 15, 2022
f6d584c
feat: delete partition.ts
jacoobes May 15, 2022
40a10bf
revert: Move enums to enums.ts
jacoobes May 15, 2022
a76099c
refactor: change loading strategy, eliminate bloat
jacoobes May 16, 2022
269ab56
refactor: Cleaning up
jacoobes May 16, 2022
bcbfd28
refactor: Cleaning up more, moving things for organization
jacoobes May 16, 2022
d9db485
refactor: switching to when statements and type predicates
jacoobes May 16, 2022
972928b
refactor: DRY Principles
jacoobes May 17, 2022
97907b7
feat: finished interactionCreate.ts handling? (need test)
jacoobes May 17, 2022
b266508
fix: Non-exhaustiveness led to commands not registering readyEvent.ts
jacoobes May 17, 2022
c8c0c84
feat: Add DefinetlyDefined type, more todo statements
jacoobes May 17, 2022
430315a
feat: Aliases optional
jacoobes May 17, 2022
2b81d53
feat: Optional plugins to reduce bloat
jacoobes May 17, 2022
53bc080
feat: better looking typings for modules
jacoobes May 17, 2022
c40b75d
refactor: Simplify sernModule handler signature
jacoobes May 17, 2022
5556b2a
refactor: make ApplicationCommandOptions optional
jacoobes May 17, 2022
f898749
refactor: make description optional
jacoobes May 17, 2022
82f1bad
refactor: Bring CommandType and PluginType to top level
jacoobes May 17, 2022
cf85a5d
fix: Fix return type of sernModule
jacoobes May 17, 2022
464fc05
refactor: Why is that not assignable bruh
jacoobes May 18, 2022
b9b5919
revert: Re-add plugins overload
jacoobes May 18, 2022
b8cda35
feat: should be able to register other nodejs event emitters
jacoobes May 19, 2022
66b9f51
fix: Standard for of does not resolve promises. Switched to for await
jacoobes May 19, 2022
115d1a4
feat: Adding sern event listeners, overriding and typing methods
jacoobes May 20, 2022
3f64a8a
feat: Edited event names for more conciseness, finished basic event e…
jacoobes May 20, 2022
2d28800
style: Run prettier
jacoobes May 20, 2022
6c144de
fix: didn't run prettier, now i am
jacoobes May 20, 2022
dac665d
fix: linting issue in markup.ts
jacoobes May 20, 2022
571a804
fix: prettier wants lf line ending
jacoobes May 20, 2022
d5bb992
fix: prettier changes again
jacoobes May 20, 2022
7ae5ecf
feat: add .prettierignore and ignore README.md
jacoobes May 20, 2022
fc81bfc
feat: add externallyUsed.ts and support BothCommands again
jacoobes May 22, 2022
a220949
feat: remove comments about prev commit
jacoobes May 22, 2022
2675607
style: change prettier print width and reformat
jacoobes May 22, 2022
77856ce
feat: adding modal and autocomplete support
jacoobes May 22, 2022
d50b801
feat: Finishing up autocomplete, need to test
jacoobes May 22, 2022
ac8a2f4
feat: Making name required in auto cmp interactions
jacoobes May 23, 2022
93942bd
feat: move name and description out of OptionsData[]
jacoobes May 24, 2022
b08eebf
feat: finishing optionData for autocomplete changes, adding class for…
jacoobes May 24, 2022
d63423c
feat: finishing autocomplete!!
jacoobes May 25, 2022
9eef9dd
refactor: Simplifying logic of message filter
jacoobes May 25, 2022
0ae541d
feat: Adding docs to some data structures, moving to default from exp…
jacoobes May 25, 2022
e69dae9
refactor: cleaning up code, removing unuseds
jacoobes May 27, 2022
475b073
feat: adding refactoring for repetitive event plugin processing
jacoobes May 29, 2022
99e2a99
feat: adding better typings, refactoring
jacoobes May 29, 2022
ae59aca
refactor: remove unnecessary nullish short circuit
jacoobes May 29, 2022
cfd68b4
refactor: remove unnecessary nullish short circuit
jacoobes May 29, 2022
f90342d
feat: add docs/ to npmignore
jacoobes May 29, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,6 @@ typings/

dist

.vs
.vs

.idea
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete this, this is already in my branch.

3 changes: 2 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
src/
tsconfig.json
tsconfig.json
docs/
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
README.md
5 changes: 3 additions & 2 deletions .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"semi": true,
"trailingComma": "all",
"singleQuote": true,
"printWidth": 120,
"tabWidth": 4
"printWidth": 100,
"tabWidth": 4,
"arrowParens": "avoid"
}
31 changes: 18 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,30 @@
# Sern Handler

<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>

Sern can automate and streamline development of your discord bot with new version compatibility and full customization.

- A reincarnation of [this old project](https://github.com/jacoobes/sern_handler)
- A reincarnation of [this old project](https://github.com/jacoobes/sern_handler)

## Installation

```sh
npm install sern-handler
```

```sh
yarn add sern-handler
```

```sh
pnpm add sern-handler
```

## Basic Usage

#### ` index.js `

```js
import { Client, Intents } from 'discord.js';
import { Sern } from 'sern-handler';
Expand All @@ -35,12 +39,12 @@ const client = new Client({
});

new Sern.Handler({
client,
prefix,
commands : 'dist/commands',
privateServers : [
client,
prefix,
commands: 'dist/commands',
privateServers: [
{
test : true,
test: true,
id: 'server-id'
}
],
Expand All @@ -54,17 +58,18 @@ client.login(token);
```

#### ` ping.js `

```js
import { Sern, Types } from 'sern-handler';
import { Ok } from 'ts-results';

export default {
export default {
alias: [],
desc : 'A ping pong command',
visibility : 'private',
test : false,
desc: 'A ping pong command',
visibility: 'private',
test: false,
type: Sern.CommandType.SLASH | Sern.CommandType.TEXT,
execute : async ({ message, interaction }, args) => 'pong!'
execute: async ({ message, interaction }, args) => 'pong!'
};
```

Expand All @@ -78,8 +83,8 @@ See [documentation](https://sern-handler.js.org) for TypeScript examples and mor

## Contribute

- Pull up on [issues](https://github.com/sern-handler/Sern/issues) and tell us, if there are bugs
- All kinds of contributions are welcomed!
- Pull up on [issues](https://github.com/sern-handler/Sern/issues) and tell us, if there are bugs
- All kinds of contributions are welcomed!

## TODO

Expand Down
Loading