Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
jacoobes committed Dec 15, 2023
2 parents fd2afa0 + 89f6bbb commit 5ba670e
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)


Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
18 changes: 7 additions & 11 deletions src/handlers/dispatchers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ export function contextArgs(wrappable: Message | BaseInteraction, messageArgs?:
return [ctx, args] as [Context, Args];
}

function interactionArg<T extends BaseInteraction>(interaction: T) {
return [interaction] as [T];
}

function intoPayload(module: Processed<Module>, ) {
return pipe(
Expand Down Expand Up @@ -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],
};
}
}
7 changes: 5 additions & 2 deletions src/handlers/event-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,10 @@ export function createMessageHandler(
}
return Files
.defaultModuleLoader<Processed<CommandModule>>(fullPath)
.then(payload => {
.then((payload)=> {
const args = contextArgs(event, rest);
return Ok({ args, ...payload });

});
});
}
Expand All @@ -128,7 +129,9 @@ export function buildModules<T extends AnyModule>(
input: ObservableInput<string>,
moduleManager: ModuleManager,
) {
return Files.buildModuleStream<Processed<T>>(input).pipe(assignDefaults(moduleManager));
return Files
.buildModuleStream<Processed<T>>(input)
.pipe(assignDefaults(moduleManager));
}


Expand Down
4 changes: 2 additions & 2 deletions src/handlers/interaction-event.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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)),
);
}
4 changes: 2 additions & 2 deletions src/handlers/message-event.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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)),
);
}

0 comments on commit 5ba670e

Please sign in to comment.