diff --git a/src/handlers/event-utils.ts b/src/handlers/event-utils.ts index e61cc2ed..e4c3c891 100644 --- a/src/handlers/event-utils.ts +++ b/src/handlers/event-utils.ts @@ -11,6 +11,7 @@ import { MonoTypeOperatorFunction, catchError, finalize, + mergeMap } from 'rxjs'; import { Files, @@ -149,8 +150,8 @@ export function executeModule( ) { return of(module).pipe( //converting the task into a promise so rxjs can resolve the Awaitable properly - concatMap(() => Result.wrapAsync(async () => task())), - concatMap(result => { + mergeMap(() => Result.wrapAsync(async () => task())), + mergeMap(result => { if (result.isOk()) { emitter.emit('module.activate', SernEmitter.success(module)); return EMPTY; diff --git a/src/handlers/interaction-event.ts b/src/handlers/interaction-event.ts index 2e150dab..0c385af6 100644 --- a/src/handlers/interaction-event.ts +++ b/src/handlers/interaction-event.ts @@ -1,5 +1,5 @@ import { Interaction } from 'discord.js'; -import { mergeMap, merge } from 'rxjs'; +import { concatMap, merge } from 'rxjs'; import { SernEmitter } from '../core'; import { isAutocomplete, @@ -28,6 +28,6 @@ export function interactionHandler([emitter, , , modules, client]: DependencyLis filterTap(e => emitter.emit('warning', SernEmitter.warning(e))), makeModuleExecutor(module => emitter.emit('module.activate', SernEmitter.failure(module, SernError.PluginFailure))), - mergeMap(payload => executeModule(emitter, payload)), + concatMap(payload => executeModule(emitter, payload)), ); } diff --git a/src/handlers/message-event.ts b/src/handlers/message-event.ts index aa7a05b2..01d7fe05 100644 --- a/src/handlers/message-event.ts +++ b/src/handlers/message-event.ts @@ -1,4 +1,4 @@ -import { mergeMap, EMPTY } from 'rxjs'; +import { concatMap, 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)); }), - mergeMap(payload => executeModule(emitter, payload)), + concatMap(payload => executeModule(emitter, payload)), ); }