reciple 6.0.0-dev.2 → 6.0.0-dev.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/dist/lib/bin.mjs +65 -0
  2. package/dist/lib/esm.mjs +1 -0
  3. package/dist/{cjs → lib}/index.js +18 -17
  4. package/dist/{cjs → lib}/reciple/classes/RecipleClient.js +17 -20
  5. package/dist/{cjs → lib}/reciple/classes/RecipleConfig.js +10 -10
  6. package/dist/lib/reciple/classes/RecipleModule.js +94 -0
  7. package/dist/{cjs → lib}/reciple/classes/builders/MessageCommandBuilder.js +1 -1
  8. package/dist/{cjs → lib}/reciple/classes/builders/MessageCommandOptionBuilder.js +0 -0
  9. package/dist/{cjs → lib}/reciple/classes/builders/SlashCommandBuilder.js +2 -5
  10. package/dist/{cjs → lib}/reciple/classes/managers/ApplicationCommandManager.js +64 -23
  11. package/dist/{cjs → lib}/reciple/classes/managers/CommandCooldownManager.js +0 -0
  12. package/dist/{cjs/reciple/classes/managers/ClientCommandManager.js → lib/reciple/classes/managers/CommandManager.js} +14 -15
  13. package/dist/{cjs → lib}/reciple/classes/managers/MessageCommandOptionManager.js +0 -0
  14. package/dist/lib/reciple/classes/managers/ModuleManager.js +179 -0
  15. package/dist/{cjs → lib}/reciple/flags.js +2 -2
  16. package/dist/{cjs → lib}/reciple/permissions.js +0 -0
  17. package/dist/lib/reciple/types/builders.js +11 -0
  18. package/dist/{cjs → lib}/reciple/types/commands.js +6 -6
  19. package/dist/{cjs → lib}/reciple/types/paramOptions.js +0 -0
  20. package/dist/{cjs/reciple/logger.js → lib/reciple/util.js} +33 -2
  21. package/dist/{cjs → lib}/reciple/version.js +0 -1
  22. package/dist/types/{bin.d.ts → bin.d.mts} +0 -0
  23. package/dist/types/esm.d.mts +1 -0
  24. package/dist/types/index.d.ts +18 -17
  25. package/dist/types/reciple/classes/RecipleClient.d.ts +6 -4
  26. package/dist/types/reciple/classes/RecipleConfig.d.ts +3 -2
  27. package/dist/types/reciple/classes/RecipleModule.d.ts +56 -0
  28. package/dist/types/reciple/classes/builders/MessageCommandBuilder.d.ts +5 -5
  29. package/dist/types/reciple/classes/builders/SlashCommandBuilder.d.ts +5 -5
  30. package/dist/types/reciple/classes/managers/ApplicationCommandManager.d.ts +43 -10
  31. package/dist/types/reciple/classes/managers/CommandCooldownManager.d.ts +2 -2
  32. package/dist/types/reciple/classes/managers/{ClientCommandManager.d.ts → CommandManager.d.ts} +6 -7
  33. package/dist/types/reciple/classes/managers/ModuleManager.d.ts +49 -0
  34. package/dist/types/reciple/types/builders.d.ts +8 -8
  35. package/dist/types/reciple/types/commands.d.ts +16 -16
  36. package/dist/types/reciple/types/paramOptions.d.ts +79 -18
  37. package/dist/types/reciple/util.d.ts +11 -0
  38. package/package.json +26 -19
  39. package/resource/reciple.yml +25 -22
  40. package/dist/cjs/bin.js +0 -50
  41. package/dist/cjs/reciple/classes/managers/ClientModuleManager.js +0 -193
  42. package/dist/cjs/reciple/types/builders.js +0 -11
  43. package/dist/cjs/reciple/util.js +0 -32
  44. package/dist/types/reciple/classes/managers/ClientModuleManager.d.ts +0 -79
  45. package/dist/types/reciple/logger.d.ts +0 -8
  46. package/docs/README.md +0 -1
@@ -1,5 +1,5 @@
1
1
  import { Guild, RestOrArray, TextBasedChannel, User } from 'discord.js';
2
- import { CommandBuilderType } from '../../types/builders';
2
+ import { CommandType } from '../../types/builders';
3
3
  /**
4
4
  * cooled-down user object interface
5
5
  */
@@ -15,7 +15,7 @@ export interface CooledDownUser {
15
15
  /**
16
16
  * Command type
17
17
  */
18
- type: CommandBuilderType;
18
+ type: CommandType;
19
19
  /**
20
20
  * In guild
21
21
  */
@@ -1,21 +1,20 @@
1
1
  import { ApplicationCommandData, Collection, GuildResolvable, RestOrArray } from 'discord.js';
2
- import { AnyCommandBuilder, AnyCommandData, AnySlashCommandBuilder, CommandBuilderType, MessageCommandData, SlashCommandData } from '../../types/builders';
2
+ import { AnyCommandBuilder, AnyCommandData, AnySlashCommandBuilder, CommandType, MessageCommandData, SlashCommandData } from '../../types/builders';
3
3
  import { MessageCommandBuilder } from '../builders/MessageCommandBuilder';
4
4
  import { SlashCommandBuilder } from '../builders/SlashCommandBuilder';
5
5
  import { RecipleClient } from '../RecipleClient';
6
6
  import { ApplicationCommandBuilder } from './ApplicationCommandManager';
7
- export interface ClientCommandManagerOptions {
7
+ export interface CommandManagerOptions {
8
8
  client: RecipleClient;
9
9
  messageCommands?: (MessageCommandBuilder | MessageCommandData)[];
10
10
  slashCommands?: (AnySlashCommandBuilder | SlashCommandData)[];
11
11
  }
12
- export declare class ClientCommandManager {
12
+ export declare class CommandManager {
13
13
  readonly client: RecipleClient;
14
14
  readonly slashCommands: Collection<string, AnySlashCommandBuilder>;
15
15
  readonly messageCommands: Collection<string, MessageCommandBuilder>;
16
16
  readonly additionalApplicationCommands: (ApplicationCommandBuilder | ApplicationCommandData)[];
17
- get applicationCommandsSize(): number;
18
- constructor(options: ClientCommandManagerOptions);
17
+ constructor(options: CommandManagerOptions);
19
18
  /**
20
19
  * Add command to command manager
21
20
  * @param commands Any command data or builder
@@ -27,8 +26,8 @@ export declare class ClientCommandManager {
27
26
  * @param type Command type
28
27
  */
29
28
  get(command: string, type?: undefined): AnyCommandBuilder | undefined;
30
- get(command: string, type?: CommandBuilderType.MessageCommand): MessageCommandBuilder | undefined;
31
- get(command: string, type?: CommandBuilderType.SlashCommand): SlashCommandBuilder | undefined;
29
+ get(command: string, type?: CommandType.MessageCommand): MessageCommandBuilder | undefined;
30
+ get(command: string, type?: CommandType.SlashCommand): SlashCommandBuilder | undefined;
32
31
  /**
33
32
  * Register application commands
34
33
  * @param guilds Register application commands to guilds
@@ -0,0 +1,49 @@
1
+ import { Collection } from 'discord.js';
2
+ import { ModuleManagerGetModulePathsOptions, ModuleManagerLoadModulesOptions, ModuleManagerResolveModuleFilesOptions, ModuleManagerStartModulesOptions, ModuleManagerUnloadModulesOptions } from '../../types/paramOptions';
3
+ import { RecipleClient } from '../RecipleClient';
4
+ import { RecipleModule, RecipleScript } from '../RecipleModule';
5
+ export interface ModuleManagerOptions {
6
+ client: RecipleClient;
7
+ modules?: (RecipleModule | RecipleScript)[];
8
+ }
9
+ export declare class ModuleManager {
10
+ readonly client: RecipleClient;
11
+ readonly modules: Collection<string, RecipleModule>;
12
+ constructor(options: ModuleManagerOptions);
13
+ /**
14
+ * Start modules
15
+ * @param options start modules options
16
+ * @returns started modules
17
+ */
18
+ startModules(options: ModuleManagerStartModulesOptions): Promise<RecipleModule[]>;
19
+ /**
20
+ * Load modules
21
+ * @param options load modules options
22
+ * @returns loaded modules
23
+ */
24
+ loadModules(options?: ModuleManagerLoadModulesOptions): Promise<RecipleModule[]>;
25
+ /**
26
+ * Unload modules
27
+ * @param options unload modules options
28
+ * @returns unloaded modules
29
+ */
30
+ unloadModules(options?: ModuleManagerUnloadModulesOptions): Promise<RecipleModule[]>;
31
+ /**
32
+ * Resolve modules from file paths
33
+ * @param options resolve module files options
34
+ * @returns resolved modules
35
+ */
36
+ resolveModuleFiles(options: ModuleManagerResolveModuleFilesOptions): Promise<RecipleModule[]>;
37
+ /**
38
+ * Validate module script
39
+ * @param script module script
40
+ * @returns `true` if script is valid
41
+ */
42
+ static validateScript(script: unknown): script is RecipleScript;
43
+ /**
44
+ * Get module file paths from folders
45
+ * @param options get module paths options
46
+ * @returns module paths
47
+ */
48
+ getModulePaths(options?: ModuleManagerGetModulePathsOptions): Promise<string[]>;
49
+ }
@@ -25,11 +25,11 @@ export declare type AnyCommandExecuteFunction<T = unknown> = SlashCommandExecute
25
25
  /**
26
26
  * Command halt function
27
27
  */
28
- export declare type CommandHaltFunction<T extends CommandBuilderType, M = unknown> = (haltData: T extends CommandBuilderType.SlashCommand ? SlashCommandHaltData<M> : T extends CommandBuilderType.MessageCommand ? MessageCommandHaltData<M> : SlashCommandHaltData<M> | MessageCommandHaltData<M>) => Awaitable<boolean | null | undefined | void>;
28
+ export declare type CommandHaltFunction<T extends CommandType, M = unknown> = (haltData: T extends CommandType.SlashCommand ? SlashCommandHaltData<M> : T extends CommandType.MessageCommand ? MessageCommandHaltData<M> : SlashCommandHaltData<M> | MessageCommandHaltData<M>) => Awaitable<boolean | null | undefined | void>;
29
29
  /**
30
30
  * Command execute function
31
31
  */
32
- export declare type CommandExecuteFunction<T extends CommandBuilderType, M = unknown> = (executeData: T extends CommandBuilderType.SlashCommand ? SlashCommandExecuteData<M> : T extends CommandBuilderType.MessageCommand ? MessageCommandExecuteData<M> : SlashCommandExecuteData<M> | MessageCommandExecuteData<M>) => Awaitable<void>;
32
+ export declare type CommandExecuteFunction<T extends CommandType, M = unknown> = (executeData: T extends CommandType.SlashCommand ? SlashCommandExecuteData<M> : T extends CommandType.MessageCommand ? MessageCommandExecuteData<M> : SlashCommandExecuteData<M> | MessageCommandExecuteData<M>) => Awaitable<void>;
33
33
  /**
34
34
  * Message command options resolvable
35
35
  */
@@ -53,15 +53,15 @@ export declare type AnySlashCommandOptionsOnlyOptionBuilder = SlashCommandAttach
53
53
  /**
54
54
  * Types of command builders
55
55
  */
56
- export declare enum CommandBuilderType {
57
- MessageCommand = 0,
58
- SlashCommand = 1
56
+ export declare enum CommandType {
57
+ SlashCommand = 1,
58
+ MessageCommand = 2
59
59
  }
60
60
  /**
61
61
  * Shared command builder methods and properties
62
62
  */
63
63
  export interface SharedCommandBuilderProperties<T = unknown> {
64
- readonly type: CommandBuilderType;
64
+ readonly type: CommandType;
65
65
  cooldown: number;
66
66
  requiredBotPermissions: PermissionResolvable[];
67
67
  requiredMemberPermissions: PermissionResolvable[];
@@ -111,7 +111,7 @@ export interface SharedCommandDataProperties {
111
111
  * Slash command object data interface
112
112
  */
113
113
  export interface SlashCommandData<T = unknown> extends SharedCommandDataProperties, Partial<Omit<SharedCommandBuilderProperties<T>, 'setCooldown' | 'setRequiredBotPermissions' | 'setRequiredMemberPermissions' | 'setHalt' | 'setExecute' | 'setMetadata' | 'halt' | 'execute'>> {
114
- type: CommandBuilderType.SlashCommand;
114
+ type: CommandType.SlashCommand;
115
115
  nameLocalizations?: LocalizationMap;
116
116
  descriptionLocalizations?: LocalizationMap;
117
117
  options?: (AnySlashCommandOptionData | AnySlashCommandOptionBuilder)[];
@@ -179,7 +179,7 @@ export interface SlashCommandSubCommandGroupData extends SharedCommandDataProper
179
179
  * Message command object data interface
180
180
  */
181
181
  export interface MessageCommandData<T = unknown> extends SharedCommandDataProperties, Partial<Omit<SharedCommandBuilderProperties<T>, 'setCooldown' | 'setRequiredBotPermissions' | 'setRequiredMemberPermissions' | 'setHalt' | 'setExecute' | 'setMetadata' | 'halt' | 'execute'>> {
182
- type: CommandBuilderType.MessageCommand;
182
+ type: CommandType.MessageCommand;
183
183
  aliases?: string[];
184
184
  validateOptions?: boolean;
185
185
  allowExecuteInDM?: boolean;
@@ -3,7 +3,7 @@ import { SlashCommandExecuteData, SlashCommandHaltData } from '../classes/builde
3
3
  import { MessageCommandOptionManager } from '../classes/managers/MessageCommandOptionManager';
4
4
  import { CooledDownUser } from '../classes/managers/CommandCooldownManager';
5
5
  import { RecipleClient } from '../classes/RecipleClient';
6
- import { CommandBuilderType } from '../types/builders';
6
+ import { CommandType } from '../types/builders';
7
7
  /**
8
8
  * Any command halt data
9
9
  */
@@ -11,7 +11,7 @@ export declare type AnyCommandHaltData<T = unknown> = SlashCommandHaltData<T> |
11
11
  /**
12
12
  * command halt data
13
13
  */
14
- export declare type CommandHaltData<T extends CommandBuilderType, M = unknown> = CommandErrorData<T, M> | CommandCooldownData<T, M> | (T extends CommandBuilderType.SlashCommand ? never : CommandInvalidArguments<T, M> | CommandMissingArguments<T, M>) | CommandMissingMemberPermissions<T, M> | CommandMissingBotPermissions<T, M>;
14
+ export declare type CommandHaltData<T extends CommandType, M = unknown> = CommandErrorHaltData<T, M> | CommandCooldownHaltData<T, M> | (T extends CommandType.SlashCommand ? never : CommandInvalidArgumentsHaltData<T, M> | CommandMissingArgumentsHaltData<T, M>) | CommandMissingMemberPermissionsHaltData<T, M> | CommandMissingBotPermissionsHaltData<T, M>;
15
15
  /**
16
16
  * Any command execute data
17
17
  */
@@ -28,7 +28,7 @@ export interface BaseCommandExecuteData {
28
28
  /**
29
29
  * Command halt reason base
30
30
  */
31
- export interface BaseCommandHaltData<T extends CommandBuilderType, M = unknown> {
31
+ export interface BaseCommandHaltData<T extends CommandType, M = unknown> {
32
32
  /**
33
33
  * Halt reason
34
34
  */
@@ -36,46 +36,46 @@ export interface BaseCommandHaltData<T extends CommandBuilderType, M = unknown>
36
36
  /**
37
37
  * Command execute da6a
38
38
  */
39
- executeData: T extends CommandBuilderType.SlashCommand ? SlashCommandExecuteData<M> : T extends CommandBuilderType.MessageCommand ? MessageCommandExecuteData<M> : AnyCommandExecuteData<M>;
39
+ executeData: T extends CommandType.SlashCommand ? SlashCommandExecuteData<M> : T extends CommandType.MessageCommand ? MessageCommandExecuteData<M> : AnyCommandExecuteData<M>;
40
40
  }
41
- export interface CommandErrorData<T extends CommandBuilderType, M = unknown> extends BaseCommandHaltData<T, M> {
41
+ export interface CommandErrorHaltData<T extends CommandType, M = unknown> extends BaseCommandHaltData<T, M> {
42
42
  reason: CommandHaltReason.Error;
43
43
  /**
44
44
  * Caught error
45
45
  */
46
46
  error: any;
47
47
  }
48
- export interface CommandCooldownData<T extends CommandBuilderType, M = unknown> extends BaseCommandHaltData<T, M>, CooledDownUser {
48
+ export interface CommandCooldownHaltData<T extends CommandType, M = unknown> extends BaseCommandHaltData<T, M>, CooledDownUser {
49
49
  reason: CommandHaltReason.Cooldown;
50
50
  }
51
- export interface CommandInvalidArguments<T extends CommandBuilderType, M = unknown> extends BaseCommandHaltData<T, M> {
51
+ export interface CommandInvalidArgumentsHaltData<T extends CommandType, M = unknown> extends BaseCommandHaltData<T, M> {
52
52
  reason: CommandHaltReason.InvalidArguments;
53
53
  /**
54
54
  * Arguments that are invalid
55
55
  */
56
56
  invalidArguments: MessageCommandOptionManager;
57
57
  }
58
- export interface CommandMissingArguments<T extends CommandBuilderType, M = unknown> extends BaseCommandHaltData<T, M> {
58
+ export interface CommandMissingArgumentsHaltData<T extends CommandType, M = unknown> extends BaseCommandHaltData<T, M> {
59
59
  reason: CommandHaltReason.MissingArguments;
60
60
  /**
61
61
  * Arguments that are missing
62
62
  */
63
63
  missingArguments: MessageCommandOptionManager;
64
64
  }
65
- export interface CommandMissingMemberPermissions<T extends CommandBuilderType, M = unknown> extends BaseCommandHaltData<T, M> {
65
+ export interface CommandMissingMemberPermissionsHaltData<T extends CommandType, M = unknown> extends BaseCommandHaltData<T, M> {
66
66
  reason: CommandHaltReason.MissingMemberPermissions;
67
67
  }
68
- export interface CommandMissingBotPermissions<T extends CommandBuilderType, M = unknown> extends BaseCommandHaltData<T, M> {
68
+ export interface CommandMissingBotPermissionsHaltData<T extends CommandType, M = unknown> extends BaseCommandHaltData<T, M> {
69
69
  reason: CommandHaltReason.MissingBotPermissions;
70
70
  }
71
71
  /**
72
72
  * Command halt reasons
73
73
  */
74
74
  export declare enum CommandHaltReason {
75
- Error = 0,
76
- Cooldown = 1,
77
- InvalidArguments = 2,
78
- MissingArguments = 3,
79
- MissingMemberPermissions = 4,
80
- MissingBotPermissions = 5
75
+ Error = 1,
76
+ Cooldown = 2,
77
+ InvalidArguments = 3,
78
+ MissingArguments = 4,
79
+ MissingMemberPermissions = 5,
80
+ MissingBotPermissions = 6
81
81
  }
@@ -1,21 +1,7 @@
1
- import { RecipleModule, RecipleScript } from '../classes/managers/ClientModuleManager';
2
1
  import { ConfigCommandPermissions } from '../classes/RecipleConfig';
3
- import { PermissionsBitField } from 'discord.js';
2
+ import { Awaitable, PermissionsBitField } from 'discord.js';
4
3
  import { AnyCommandBuilder } from './builders';
5
- export interface RecipleClientAddModuleOptions {
6
- /**
7
- * The module script
8
- */
9
- script: RecipleScript;
10
- /**
11
- * Register application commands if possible
12
- */
13
- registerApplicationCommands?: boolean;
14
- /**
15
- * Module optional info
16
- */
17
- moduleInfo?: RecipleModule['info'];
18
- }
4
+ import { RecipleModule } from '../classes/RecipleModule';
19
5
  export interface UserHasCommandPermissionsOptions {
20
6
  /**
21
7
  * Command builder
@@ -33,8 +19,83 @@ export interface UserHasCommandPermissionsOptions {
33
19
  commands: ConfigCommandPermissions[];
34
20
  };
35
21
  }
36
- export interface ModuleManagerResolveFilesOptions {
22
+ export interface ModuleManagerResolveModuleFilesOptions {
23
+ /**
24
+ * valid reciple module (ESM or CJS) Javascript file paths
25
+ */
37
26
  files: string[];
27
+ /**
28
+ * Allow loading unsupported module versions
29
+ * @default false
30
+ */
38
31
  disabeVersionCheck?: boolean;
39
- dontSkipError?: boolean;
32
+ /**
33
+ * Ignore errors
34
+ * @dafault true
35
+ */
36
+ ignoreErrors?: boolean;
37
+ }
38
+ export interface ModuleManagerGetModulePathsOptions {
39
+ /**
40
+ * Get javascript module file paths from folders
41
+ */
42
+ folders?: string[];
43
+ /**
44
+ * Add ignored files (wildcard)
45
+ * @example _*.js // Ignores _module.js and _hi.js
46
+ */
47
+ ignoredFiles?: string[];
48
+ /**
49
+ * Filter found javascript files
50
+ * @param file Loaded javascript file
51
+ * @returns `true` if the path is acceptable
52
+ */
53
+ filter?: (file: string) => Awaitable<boolean>;
54
+ }
55
+ export interface ModuleManagerStartModulesOptions {
56
+ /**
57
+ * Modules to start
58
+ */
59
+ modules: RecipleModule[];
60
+ /**
61
+ * Add modules to Client modules collection
62
+ * @default true
63
+ */
64
+ addToModulesCollection?: boolean;
65
+ /**
66
+ * Ignore errors
67
+ * @default true
68
+ */
69
+ ignoreErrors?: boolean;
70
+ }
71
+ export interface ModuleManagerLoadModulesOptions {
72
+ /**
73
+ * Modules to execute `load` method
74
+ */
75
+ modules?: RecipleModule[];
76
+ /**
77
+ * Add commands to client
78
+ * @default true
79
+ */
80
+ resolveCommands?: boolean;
81
+ /**
82
+ * Ignore errors
83
+ * @default true
84
+ */
85
+ ignoreErrors?: boolean;
86
+ }
87
+ export interface ModuleManagerUnloadModulesOptions {
88
+ /**
89
+ * Modules to execute `unload` method
90
+ */
91
+ modules?: RecipleModule[];
92
+ /**
93
+ * Reason for unloading modules
94
+ */
95
+ reason?: string;
96
+ /**
97
+ * Ignore errors
98
+ * @default true
99
+ */
100
+ ignoreErrors?: boolean;
40
101
  }
@@ -1,3 +1,6 @@
1
+ /// <reference types="node" />
2
+ import { Logger } from 'fallout-utility';
3
+ import { default as _path } from 'path';
1
4
  import { AnyCommandBuilder } from './types/builders';
2
5
  /**
3
6
  * Check if an object is a class
@@ -10,3 +13,11 @@ export declare function isClass<T = any>(object: any): object is T;
10
13
  */
11
14
  export declare function deprecationWarning(content: string | Error): void;
12
15
  export declare function validateCommandBuilder(command: AnyCommandBuilder): boolean;
16
+ /**
17
+ * Create new logger
18
+ * @param stringifyJSON stringify json objects in console
19
+ * @param debugmode display debug messages
20
+ * @param colorizeMessage add logger colours to messages
21
+ */
22
+ export declare function createLogger(stringifyJSON: boolean, debugmode?: boolean, colorizeMessage?: boolean): Logger;
23
+ export declare const path: _path.PlatformPath;
package/package.json CHANGED
@@ -1,18 +1,26 @@
1
1
  {
2
2
  "name": "reciple",
3
- "version": "6.0.0-dev.2",
4
- "bin": "./dist/cjs/bin.js",
3
+ "version": "6.0.0-dev.20",
4
+ "bin": "./dist/lib/bin.mjs",
5
5
  "license": "GPL-3.0",
6
- "main": "./dist/cjs/index.js",
6
+ "type": "commonjs",
7
+ "main": "./dist/lib/index.js",
7
8
  "types": "./dist/types/index.d.ts",
8
- "module": "./dist/mjs/index.js",
9
+ "module": "./dist/lib/esm.mjs",
9
10
  "author": "FalloutStudios",
10
11
  "description": "Handler for Discord.js",
11
12
  "homepage": "https://reciple.js.org",
12
13
  "exports": {
13
- "require": "./dist/cjs/index.js",
14
- "import": "./dist/mjs/index.js",
15
- "types": "./dist/types/index.d.ts"
14
+ ".": {
15
+ "import": {
16
+ "types": "./dist/types/index.d.ts",
17
+ "default": "./dist/lib/esm.mjs"
18
+ },
19
+ "require": {
20
+ "types": "./dist/types/index.d.ts",
21
+ "default": "./dist/lib/index.js"
22
+ }
23
+ }
16
24
  },
17
25
  "keywords": [
18
26
  "Discord",
@@ -26,14 +34,14 @@
26
34
  "url": "https://github.com/FalloutStudios/reciple/issues"
27
35
  },
28
36
  "scripts": {
29
- "format": "yarn prettier --write src",
30
- "clean": "yarn exec rimraf dist",
31
- "build": "yarn clean && yarn format && yarn exec tsc",
32
- "build:publish": "yarn build && yarn docs && yarn npm publish",
33
- "build:publish-dev": "yarn build && yarn npm publish --tag dev",
34
- "test": "yarn build && yarn workspace test start",
35
- "docs": "yarn exec docgen --typescript true -c ./docs/index.json -o ./docs/docs.json -i src/index.ts",
36
- "watch": "yarn exec tsc --watch --noEmit"
37
+ "format": "npx prettier --write src",
38
+ "clean": "npx rimraf dist",
39
+ "build": "npm run clean && npx tsc",
40
+ "build:publish": "npm run format && npm run build && npm run docs && npm publish",
41
+ "build:publish-dev": "npm run format && npm run build && npm publish --tag dev",
42
+ "test": "npm run build && npm install && npm run start -w test",
43
+ "docs": "npx docgen --typescript true -c ./docs/index.json -o ./docs/docs.json -i src/index.ts",
44
+ "watch": "npx tsc --watch --noEmit"
37
45
  },
38
46
  "repository": {
39
47
  "type": "git",
@@ -53,7 +61,7 @@
53
61
  "chalk": "4.1.2",
54
62
  "commander": "^9.4.1",
55
63
  "dotenv": "^16.0.3",
56
- "fallout-utility": "^1.5.4",
64
+ "fallout-utility": "^1.5.13",
57
65
  "semver": "^7.3.7",
58
66
  "wildcard-match": "^5.1.2",
59
67
  "yaml": "^2.1.1"
@@ -72,6 +80,5 @@
72
80
  },
73
81
  "workspaces": [
74
82
  "test"
75
- ],
76
- "packageManager": "yarn@3.2.2"
77
- }
83
+ ]
84
+ }
@@ -4,20 +4,24 @@ token: TOKEN
4
4
 
5
5
  # Commands options
6
6
  commands:
7
- # message command options
8
- messageCommand:
9
- # enable message commands
7
+ # Interaction command options
8
+ slashCommand:
9
+ # enable interaction commands
10
10
  enabled: true
11
- # command prefix
12
- prefix: '!'
13
11
  # reply when an error occured
14
12
  replyOnError: false
15
13
  # enable the use of command cooldowns
16
14
  enableCooldown: true
17
- # allow executing commands via aliases
18
- allowCommandAlias: true
19
- # command argument separator
20
- commandArgumentSeparator: ' '
15
+ # register interaction commands on bot ready
16
+ registerCommands: true
17
+ # allow register empty list of application commands
18
+ allowRegisterEmptyCommandList: true
19
+ # set required permissions for interaction commands
20
+ setRequiredPermissions: true
21
+ # accept replied or deffered command interaction
22
+ acceptRepliedInteractions: false
23
+ # register commands to specific guild(s) empty to make it global
24
+ guilds: []
21
25
  # overwrite command permissions
22
26
  permissions:
23
27
  # enable overwriten command permissions
@@ -27,22 +31,20 @@ commands:
27
31
  permissions:
28
32
  - Administrator
29
33
 
30
- # Interaction command options
31
- slashCommand:
32
- # enable interaction commands
34
+ # message command options
35
+ messageCommand:
36
+ # enable message commands
33
37
  enabled: true
38
+ # command prefix
39
+ prefix: '!'
34
40
  # reply when an error occured
35
41
  replyOnError: false
36
42
  # enable the use of command cooldowns
37
43
  enableCooldown: true
38
- # register interaction commands on bot ready
39
- registerCommands: true
40
- # set required permissions for interaction commands
41
- setRequiredPermissions: true
42
- # accept replied or deffered command interaction
43
- acceptRepliedInteractions: false
44
- # register commands to specific guild(s) empty to make it global
45
- guilds: []
44
+ # allow executing commands via aliases
45
+ allowCommandAlias: true
46
+ # command argument separator
47
+ commandArgumentSeparator: ' '
46
48
  # overwrite command permissions
47
49
  permissions:
48
50
  # enable overwriten command permissions
@@ -52,7 +54,6 @@ commands:
52
54
  permissions:
53
55
  - Administrator
54
56
 
55
-
56
57
  # Logger options
57
58
  fileLogging:
58
59
  # enable console output to file
@@ -93,7 +94,9 @@ messages:
93
94
  ephemeral: true
94
95
 
95
96
  # Ignored Files
96
- ignoredFiles: []
97
+ ignoredFiles:
98
+ - '_*'
99
+ - '.*'
97
100
 
98
101
 
99
102
  ####################################################
package/dist/cjs/bin.js DELETED
@@ -1,50 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- var __importDefault = (this && this.__importDefault) || function (mod) {
4
- return (mod && mod.__esModule) ? mod : { "default": mod };
5
- };
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- const RecipleClient_1 = require("./reciple/classes/RecipleClient");
8
- const RecipleConfig_1 = require("./reciple/classes/RecipleConfig");
9
- const version_1 = require("./reciple/version");
10
- const fs_1 = require("fs");
11
- const flags_1 = require("./reciple/flags");
12
- const fallout_utility_1 = require("fallout-utility");
13
- const chalk_1 = __importDefault(require("chalk"));
14
- require("dotenv/config");
15
- const path_1 = __importDefault(require("path"));
16
- const allowedFiles = ['node_modules', 'reciple.yml', 'package.json'];
17
- const configPath = path_1.default.join(flags_1.cwd, './reciple.yml');
18
- if ((0, fs_1.readdirSync)(flags_1.cwd).filter(f => !f.startsWith('.') && allowedFiles.indexOf(f)).length > 0 && !(0, fs_1.existsSync)(flags_1.flags.config ?? configPath)) {
19
- const ask = (flags_1.flags.yes ? 'y' : null) ?? (0, fallout_utility_1.input)('This directory does not contain reciple.yml. Would you like to init axis here? [y/n] ') ?? '';
20
- if (ask.toString().toLowerCase() !== 'y')
21
- process.exit(0);
22
- }
23
- let configParser;
24
- try {
25
- configParser = new RecipleConfig_1.RecipleConfig(flags_1.flags.config ?? configPath).parseConfig();
26
- }
27
- catch (err) {
28
- console.error(`${chalk_1.default.bold.red('Config Error')}: ${chalk_1.default.white(err.message)}`);
29
- process.exit(1);
30
- }
31
- const config = configParser.getConfig();
32
- const client = new RecipleClient_1.RecipleClient({ config: config, ...config.client });
33
- if (!client.isClientLogsSilent)
34
- client.logger.info('Starting Reciple client v' + version_1.rawVersion);
35
- (async () => {
36
- client.addCommandListeners();
37
- await client.modules.startModulesFromFiles({
38
- files: await client.modules.getModuleFiles(),
39
- });
40
- client.on('ready', async () => {
41
- await client.modules.loadAll(true);
42
- if (!client.isClientLogsSilent)
43
- client.logger.warn(`Logged in as ${client.user?.tag || 'Unknown'}!`);
44
- client.on('cacheSweep', () => client.cooldowns.clean());
45
- });
46
- client.login(config.token).catch(err => {
47
- if (!client.isClientLogsSilent)
48
- client.logger.error(err);
49
- });
50
- })();