diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index 4cbf3ec2..14bdcaa2 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -6,7 +6,7 @@ jobs: release-please: runs-on: ubuntu-latest steps: - - uses: google-github-actions/release-please-action@ca6063f4ed81b55db15b8c42d1b6f7925866342d # v3 + - uses: google-github-actions/release-please-action@db8f2c60ee802b3748b512940dde88eabd7b7e01 # v3 with: release-type: node package-name: release-please-action diff --git a/CHANGELOG.md b/CHANGELOG.md index 75ae1419..14ac962b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## [3.1.1](https://github.com/sern-handler/handler/compare/v3.1.0...v3.1.1) (2023-11-06) + + +### Bug Fixes + +* queuing events ([fd39858](https://github.com/sern-handler/handler/commit/fd39858636d3038abb6d91021b65c99c488a3d6e)) +* queuing events ([#332](https://github.com/sern-handler/handler/issues/332)) @Benzo-Fury ([#333](https://github.com/sern-handler/handler/issues/333)) ([fd39858](https://github.com/sern-handler/handler/commit/fd39858636d3038abb6d91021b65c99c488a3d6e)) + ## [3.1.0](https://github.com/sern-handler/handler/compare/v3.0.2...v3.1.0) (2023-09-04) diff --git a/README.md b/README.md index d47ce3bc..804d4726 100644 --- a/README.md +++ b/README.md @@ -18,10 +18,9 @@ - For you. A framework that's tailored to your exact needs. - Lightweight. Does a lot while being small. - Latest features. Support for discord.js v14 and all of its interactions. -- Hybrid, customizable and composable commands. Create them just how you like. - Start quickly. Plug and play or customize to your liking. -- Embraces reactive programming. For consistent and reliable backend. - Switch and customize how errors are handled, logging, and more. +- works with [bun](https://bun.sh/) and [node](https://nodejs.org/en) out the box! - Use it with TypeScript or JavaScript. CommonJS and ESM supported. - Active and growing community, always here to help. [Join us](https://sern.dev/discord) - Unleash its full potential with a powerful CLI and awesome plugins. diff --git a/src/handlers/dispatchers.ts b/src/handlers/dispatchers.ts index 1ceb52ca..cc1525e8 100644 --- a/src/handlers/dispatchers.ts +++ b/src/handlers/dispatchers.ts @@ -28,9 +28,6 @@ export function contextArgs(wrappable: Message | BaseInteraction, messageArgs?: return [ctx, args] as [Context, Args]; } -function interactionArg(interaction: T) { - return [interaction] as [T]; -} function intoPayload(module: Processed, ) { return pipe( @@ -90,15 +87,14 @@ export function createDispatcher(payload: { args: [payload.event], }; } - return { + return { + module: payload.module, args: contextArgs(payload.event), - ...payload, - }; + }; } - default: - return { - args: interactionArg(payload.event), - ...payload, - } + default: return { + module: payload.module, + args: [payload.event], + }; } } diff --git a/src/handlers/event-utils.ts b/src/handlers/event-utils.ts index c4935cb6..5af439a9 100644 --- a/src/handlers/event-utils.ts +++ b/src/handlers/event-utils.ts @@ -100,9 +100,10 @@ export function createMessageHandler( } return Files .defaultModuleLoader>(fullPath) - .then(payload => { + .then((payload)=> { const args = contextArgs(event, rest); return Ok({ args, ...payload }); + }); }); } @@ -128,7 +129,9 @@ export function buildModules( input: ObservableInput, moduleManager: ModuleManager, ) { - return Files.buildModuleStream>(input).pipe(assignDefaults(moduleManager)); + return Files + .buildModuleStream>(input) + .pipe(assignDefaults(moduleManager)); } diff --git a/src/handlers/interaction-event.ts b/src/handlers/interaction-event.ts index 2519c871..a39e2807 100644 --- a/src/handlers/interaction-event.ts +++ b/src/handlers/interaction-event.ts @@ -1,5 +1,5 @@ import { Interaction } from 'discord.js'; -import { concatMap, merge } from 'rxjs'; +import { mergeMap, merge } from 'rxjs'; import { SernEmitter } from '../core'; import { isAutocomplete, @@ -28,6 +28,6 @@ export function interactionHandler([emitter, err, log, modules, client]: Depende filterTap(e => emitter.emit('warning', SernEmitter.warning(e))), makeModuleExecutor(module => emitter.emit('module.activate', SernEmitter.failure(module, SernError.PluginFailure))), - concatMap(payload => executeModule(emitter, log, err, payload)), + mergeMap(payload => executeModule(emitter, log, err, payload)), ); } diff --git a/src/handlers/message-event.ts b/src/handlers/message-event.ts index 590ad5ef..bb548758 100644 --- a/src/handlers/message-event.ts +++ b/src/handlers/message-event.ts @@ -1,4 +1,4 @@ -import { concatMap, EMPTY } from 'rxjs'; +import { mergeMap, EMPTY } from 'rxjs'; import type { Message } from 'discord.js'; import { SernEmitter } from '../core'; import { sharedEventStream, SernError, filterTap } from '../core/_internal'; @@ -42,6 +42,6 @@ export function messageHandler( makeModuleExecutor(module => { emitter.emit('module.activate', SernEmitter.failure(module, SernError.PluginFailure)); }), - concatMap(payload => executeModule(emitter, log, err, payload)), + mergeMap(payload => executeModule(emitter, log, err, payload)), ); }