mirror of
https://github.com/sern-handler/handler
synced 2026-06-06 01:16:55 +00:00
build : Added ts-pattern for pattern matching with command types and
plugin types
This commit is contained in:
15
package-lock.json
generated
15
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@sern/handler",
|
||||
"version": "0.1.0",
|
||||
"version": "0.0.1",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@sern/handler",
|
||||
"version": "0.1.0",
|
||||
"version": "0.0.1",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@typescript-eslint/eslint-plugin": "^5.10.2",
|
||||
@@ -15,6 +15,7 @@
|
||||
"eslint": "^8.8.0",
|
||||
"prettier": "^2.5.1",
|
||||
"rxjs": "^7.5.5",
|
||||
"ts-pattern": "^4.0.2",
|
||||
"ts-results": "^3.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
@@ -8418,6 +8419,11 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/ts-pattern": {
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://registry.npmjs.org/ts-pattern/-/ts-pattern-4.0.2.tgz",
|
||||
"integrity": "sha512-eHqR/7A6fcw05vCOfnL6RwgGJbVi9G/YHTdYdjYmElhDdJ1SMn7pWs+6+YuxygaFwQS/g+cIDlu+UD8IVpur1A=="
|
||||
},
|
||||
"node_modules/ts-results": {
|
||||
"version": "3.3.0",
|
||||
"resolved": "https://registry.npmjs.org/ts-results/-/ts-results-3.3.0.tgz",
|
||||
@@ -15236,6 +15242,11 @@
|
||||
"yn": "3.1.1"
|
||||
}
|
||||
},
|
||||
"ts-pattern": {
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://registry.npmjs.org/ts-pattern/-/ts-pattern-4.0.2.tgz",
|
||||
"integrity": "sha512-eHqR/7A6fcw05vCOfnL6RwgGJbVi9G/YHTdYdjYmElhDdJ1SMn7pWs+6+YuxygaFwQS/g+cIDlu+UD8IVpur1A=="
|
||||
},
|
||||
"ts-results": {
|
||||
"version": "3.3.0",
|
||||
"resolved": "https://registry.npmjs.org/ts-results/-/ts-results-3.3.0.tgz",
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"version": "0.0.1",
|
||||
"description": "",
|
||||
"main": "dist/index.js",
|
||||
"scripts": {
|
||||
"scripts": {
|
||||
"compile": "tsc",
|
||||
"watch": "tsc -w",
|
||||
"lint": "eslint src/**/*.ts",
|
||||
@@ -23,6 +23,7 @@
|
||||
"eslint": "^8.8.0",
|
||||
"prettier": "^2.5.1",
|
||||
"rxjs": "^7.5.5",
|
||||
"ts-pattern": "^4.0.2",
|
||||
"ts-results": "^3.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -3,6 +3,8 @@ import { ApplicationCommandType, Interaction } from 'discord.js';
|
||||
import { fromEvent, Observable, of, concatMap, map, filter } from 'rxjs';
|
||||
import { CommandType } from '../sern';
|
||||
import Context from '../structures/context';
|
||||
import type { ModuleDefs } from '../structures/modules/commands/moduleHandler';
|
||||
import type { PluggedModule } from '../structures/modules/module';
|
||||
import type Wrapper from '../structures/wrapper';
|
||||
import * as Files from '../utilities/readFile';
|
||||
import { match, partition } from './observableHandling';
|
||||
@@ -16,9 +18,6 @@ export const onInteractionCreate = ( wrapper : Wrapper ) => {
|
||||
|
||||
const interactionEvent$ = (<Observable<Interaction>> fromEvent(client, 'interactionCreate'))
|
||||
|
||||
const processPlugins = <T extends keyof ModuleDefs>( plug : Observable<PluggedModule|undefined> ) => {
|
||||
return plug
|
||||
};
|
||||
|
||||
const processCommand$ = interactionEvent$.pipe(
|
||||
concatMap( interaction => {
|
||||
|
||||
Reference in New Issue
Block a user