refactor(structures) create structures dir

This commit is contained in:
Jacob Nguyen
2022-03-08 00:30:18 -06:00
parent 36831def0f
commit 9e4adf8bcf
6 changed files with 31 additions and 25 deletions

View File

@@ -1,5 +1,4 @@
import * as Files from './utilities/readFile';
import type {
possibleOutput,
} from '../types/handler';
@@ -15,12 +14,13 @@ import { Ok, None, Some } from 'ts-results';
import { isNotFromBot, hasPrefix, fmt } from './utilities/messageHelpers';
import Logger, { sEvent } from './logger';
import { AllTrue } from './utilities/higherOrders';
import type Module from './module';
import Context from './context';
import type Module from './structures/module';
import Context from './structures/context';
import type Wrapper from './structures/wrapper';
/**
* @class
*/
export class Handler {
private wrapper: Wrapper;
private defaultLogger: Logger = new Logger();
@@ -272,22 +272,7 @@ export class Handler {
}
}
/**
* An object to be passed into Sern.Handler constructor.
* @typedef {object} Wrapper
* @property {readonly Client} client
* @property {readonly string} prefix
* @property {readonly string} commands
* @prop {(handler : Handler) => void)} init
* @property {readonly {test: boolean, id: string}[]} privateServers
*/
export interface Wrapper {
readonly client: Client;
readonly prefix: string;
readonly commands: string;
init?: (handler: Handler) => void;
readonly privateServers: { test: boolean; id: string }[];
}

View File

@@ -1,9 +1,9 @@
import type { Visibility, possibleOutput, Arg } from '../types/handler';
import type { CommandType } from './sern';
import type { Visibility, possibleOutput, Arg } from '../../types/handler';
import type { CommandType } from '../sern';
import type Context from './context' ;
import type { Awaitable } from 'discord.js';
import type { Ok } from 'ts-results';
import type * as Utils from './utilities/preprocessors/args';
import type * as Utils from '../utilities/preprocessors/args';
/**
* An object that gets imported and acts as a command.

View File

@@ -0,0 +1,21 @@
import type { Client } from 'discord.js';
import type * as Sern from '../sern';
/**
* An object to be passed into Sern.Handler constructor.
* @typedef {object} Wrapper
* @property {readonly Client} client
* @property {readonly string} prefix
* @property {readonly string} commands
* @prop {(handler : Handler) => void)} ini
* @property {readonly {test: boolean, id: string}[]} privateServers
*/
interface Wrapper {
readonly client: Client;
readonly prefix: string;
readonly commands: string;
init?: (handler: Sern.Handler) => void;
readonly privateServers: { test: boolean; id: string }[];
}
export default Wrapper;

View File

@@ -1,6 +1,6 @@
import type { ApplicationCommandOptionData } from 'discord.js';
import type * as Sern from '../sern';
import type Module from '../module';
import type Module from '../structures/module';
import { readdirSync, statSync } from 'fs';
import { basename, join } from 'path';

View File

@@ -5,7 +5,7 @@ import type {
MessageOptions,
} from 'discord.js';
import type Module from '../handler/module';
import type Module from '../handler/structures/module';
export type Visibility = 'private' | 'public';