fix(messageEvent) : fix access location for messages

This commit is contained in:
Jacob Nguyen
2022-04-29 15:33:18 -05:00
parent 9e05090214
commit 2c8fdce7e1
3 changed files with 14 additions and 14 deletions

View File

@@ -13,9 +13,18 @@ export const onInteractionCreate = ( wrapper : Wrapper ) => {
const { client } = wrapper;
const interactionEvent = (<Observable<Interaction>> fromEvent(client, 'interactionCreate'))
interactionEvent.pipe(
tap(console.log)
concatMap ( async interaction => {
if(interaction.isCommand()) {
return of(
Files.ApplicationCommandStore[interaction.commandType]
.get(interaction.commandName)).pipe(
)
}
})
).subscribe()
/** concatMap (async interaction => {
if (interaction.isChatInputCommand()) {

View File

@@ -23,7 +23,7 @@ export const onMessageCreate = (wrapper : Wrapper) => {
return {
ctx : Context.wrap(message),
args : <Args>['text', rest],
mod : Files.Commands.get(prefix) ?? Files.Alias.get(prefix)
mod : Files.ApplicationCommandStore[1].get(prefix) ?? Files.Alias.get(prefix)
}
}));
@@ -60,7 +60,4 @@ export const onMessageCreate = (wrapper : Wrapper) => {
}
})
};

View File

@@ -2,6 +2,7 @@ import { ApplicationCommandType, ComponentType, InteractionType, MessageComponen
import { readdirSync, statSync } from 'fs';
import { join } from 'path';
import { from, Observable } from 'rxjs';
import { CommandType } from '../sern';
import type { PluggedModule } from '../structures/modules/module';
@@ -17,17 +18,10 @@ export const MessageCompCommandStore = {
[ComponentType.SelectMenu] : new Map<string, PluggedModule>()
}
export const TextCommandStore = {
[420] : new Map<string, PluggedModule>() // Aliases
[CommandType.Text] : new Map<string, PluggedModule>() // Aliases
}
export const Alias = new Map<string, PluggedModule>();
export const ContextMenuUser = new Map<string, PluggedModule>();
export const ContextMenuMsg = new Map<string, PluggedModule>();
export const Buttons = new Map<string, PluggedModule>();
export const SelectMenus = new Map<string, PluggedModule>();
// Courtesy @Townsy45
function readPath(dir: string, arrayOfFiles: string[] = []): string[] {
try {