Archived
simplified export
This commit is contained in:
1 parent
2ceb32e186
commit
6cd71bbf31
4 files changed
+17
-24
No files matched your search
+2
-2
@@ -26,7 +26,7 @@ interface ConstructorOptions {
|
||||
}
|
||||
|
||||
//MAIN CLASS
|
||||
class Bot extends EventEmitter {
|
||||
export class Bot extends EventEmitter {
|
||||
name: string;
|
||||
client: Client;
|
||||
commands: CommandManager;
|
||||
@@ -114,6 +114,7 @@ class Bot extends EventEmitter {
|
||||
try {
|
||||
await cmdMsg.command.start(m, cmdMsg.arguments);
|
||||
} catch (e) {
|
||||
this.emit("error", [e]);
|
||||
if (e instanceof PermissionsError) {
|
||||
this.messages.system.send(
|
||||
"PERMISSION",
|
||||
@@ -160,4 +161,3 @@ class Bot extends EventEmitter {
|
||||
|
||||
//EXPORTS
|
||||
export default Bot;
|
||||
export { Bot, Command };
|
||||
+10
-13
@@ -8,6 +8,13 @@ import {
|
||||
} from "discord.js";
|
||||
|
||||
//TYPE DEFINITIONS
|
||||
type GetMode = "ALL" | "PREFIX" | "NO_PREFIX";
|
||||
type PermissionCheckTypes = "ALL" | "ANY";
|
||||
export interface CommandMessageStructure {
|
||||
name: string;
|
||||
arguments: string[];
|
||||
command: Command | null;
|
||||
}
|
||||
interface CommandBuilder {
|
||||
name: string;
|
||||
aliases?: string[] | string;
|
||||
@@ -22,20 +29,13 @@ interface CommandBuilder {
|
||||
cmdArguments?: string[]
|
||||
) => void | string | MessageEmbed | Promise<void | string | MessageEmbed>;
|
||||
}
|
||||
interface CommandMessageStructure {
|
||||
name: string;
|
||||
arguments: string[];
|
||||
command: Command | null;
|
||||
}
|
||||
interface PhraseOccurrenceData {
|
||||
command: Command;
|
||||
type: "NAME" | "ALIAS";
|
||||
}
|
||||
type GetMode = "ALL" | "PREFIX" | "NO_PREFIX";
|
||||
type PermissionCheckTypes = "ALL" | "ANY";
|
||||
|
||||
//ERROR CLASSES
|
||||
class PermissionsError {
|
||||
export class PermissionsError {
|
||||
private command: Command;
|
||||
private user: GuildMember | null;
|
||||
constructor(command: Command, user?: GuildMember | null) {
|
||||
@@ -48,7 +48,7 @@ class PermissionsError {
|
||||
}
|
||||
|
||||
//CLASSES
|
||||
class Command {
|
||||
export class Command {
|
||||
name: string;
|
||||
aliases: string[];
|
||||
keywords: string[];
|
||||
@@ -137,7 +137,7 @@ class Command {
|
||||
}
|
||||
}
|
||||
}
|
||||
class CommandManager {
|
||||
export class CommandManager {
|
||||
list: Command[];
|
||||
prefix: string;
|
||||
argumentSeparator: string;
|
||||
@@ -317,6 +317,3 @@ class CommandManager {
|
||||
return returnValue;
|
||||
}
|
||||
}
|
||||
|
||||
//EXPORTS
|
||||
export { Command, CommandManager, CommandMessageStructure, PermissionsError };
|
||||
+2
-4
@@ -1,7 +1,7 @@
|
||||
import { ColorResolvable, MessageEmbed } from "discord.js";
|
||||
import { Command, CommandManager } from "./Command.js";
|
||||
|
||||
interface HelpMessageParams {
|
||||
export interface HelpMessageParams {
|
||||
title: string;
|
||||
bottomText: string;
|
||||
color: ColorResolvable;
|
||||
@@ -9,7 +9,7 @@ interface HelpMessageParams {
|
||||
usage: string;
|
||||
}
|
||||
|
||||
class HelpMessage extends Command {
|
||||
export class HelpMessage extends Command {
|
||||
constructor(
|
||||
cmdManager: CommandManager,
|
||||
params: HelpMessageParams,
|
||||
@@ -89,5 +89,3 @@ class HelpMessage extends Command {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export { HelpMessage, HelpMessageParams };
|
||||
@@ -10,8 +10,8 @@ import {
|
||||
} from "discord.js";
|
||||
import { Command, PermissionsError } from "./Command.js";
|
||||
|
||||
type MessageType = "PERMISSION" | "ERROR" | "NOT_FOUND";
|
||||
interface SystemMessageAppearance {
|
||||
export type MessageType = "PERMISSION" | "ERROR" | "NOT_FOUND";
|
||||
export interface SystemMessageAppearance {
|
||||
title: string;
|
||||
bottomText?: string;
|
||||
accentColor?: ColorResolvable;
|
||||
@@ -25,7 +25,7 @@ interface SystemMessageData {
|
||||
error?: Error | PermissionsError | string;
|
||||
}
|
||||
|
||||
class SystemMessageManager {
|
||||
export class SystemMessageManager {
|
||||
enabled: boolean;
|
||||
PERMISSION: SystemMessageAppearance;
|
||||
ERROR: SystemMessageAppearance;
|
||||
@@ -167,5 +167,3 @@ class SystemMessageManager {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export { MessageType, SystemMessageAppearance, SystemMessageManager };
|
||||
Reference in new issue
Block a user