feat: Making name required in auto cmp interactions

This commit is contained in:
Jacob Nguyen
2022-05-23 00:54:40 -05:00
parent d50b8013ee
commit ac8a2f4c86
3 changed files with 119 additions and 237 deletions

View File

@@ -1,4 +1,4 @@
import { concat, concatMap, from, fromEvent, map, Observable, of, skip, take } from 'rxjs';
import { concat, concatMap, from, fromEvent, map, Observable, of, skip, take, throwError } from 'rxjs';
import { basename } from 'path';
import * as Files from '../utilities/readFile';
import type Wrapper from '../structures/wrapper';
@@ -27,6 +27,9 @@ export const onReady = (wrapper: Wrapper) => {
);
const processPlugins$ = processCommandFiles$.pipe(
concatMap(mod => {
if(mod.type === CommandType.Autocomplete) {
return throwError(() => SernError.NonValidModuleType + `. You cannot use command plugins and Autocomplete.`);
}
const cmdPluginsRes =
mod.plugins?.map(plug => {
return {

View File

@@ -111,6 +111,7 @@ export type ModalSubmitCommand = Override<
export type AutocompleteCommand = Override<
BaseModule,
{
name : string,
type: CommandType.Autocomplete;
onEvent?: EventPlugin<CommandType.Autocomplete>[];
execute: (ctx: AutocompleteInteraction) => Awaitable<void>;