mirror of
https://github.com/sern-handler/handler
synced 2026-06-26 17:52:14 +00:00
refactor(structures) create structures dir
This commit is contained in:
@@ -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 }[];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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.
|
||||
21
src/handler/structures/wrapper.ts
Normal file
21
src/handler/structures/wrapper.ts
Normal 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;
|
||||
@@ -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';
|
||||
|
||||
@@ -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';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user