reciple 5.4.1-pre.3 → 5.4.1

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 (60) hide show
  1. package/bin/{types/bin.d.ts → bin.d.ts} +0 -0
  2. package/bin/{cjs/bin.js → bin.js} +0 -0
  3. package/bin/{types/index.d.ts → index.d.ts} +0 -0
  4. package/bin/{cjs/index.js → index.js} +0 -0
  5. package/bin/{types/reciple → reciple}/classes/CommandCooldownManager.d.ts +0 -0
  6. package/bin/{cjs/reciple → reciple}/classes/CommandCooldownManager.js +0 -0
  7. package/bin/{types/reciple → reciple}/classes/MessageCommandOptionManager.d.ts +0 -0
  8. package/bin/{cjs/reciple → reciple}/classes/MessageCommandOptionManager.js +0 -0
  9. package/bin/{types/reciple → reciple}/classes/RecipleClient.d.ts +0 -0
  10. package/bin/{cjs/reciple → reciple}/classes/RecipleClient.js +0 -0
  11. package/bin/{types/reciple → reciple}/classes/RecipleConfig.d.ts +0 -0
  12. package/bin/{cjs/reciple → reciple}/classes/RecipleConfig.js +0 -0
  13. package/bin/{types/reciple → reciple}/classes/builders/MessageCommandBuilder.d.ts +0 -0
  14. package/bin/{cjs/reciple → reciple}/classes/builders/MessageCommandBuilder.js +0 -0
  15. package/bin/{types/reciple → reciple}/classes/builders/MessageCommandOptionBuilder.d.ts +0 -0
  16. package/bin/{cjs/reciple → reciple}/classes/builders/MessageCommandOptionBuilder.js +0 -0
  17. package/bin/{types/reciple → reciple}/classes/builders/SlashCommandBuilder.d.ts +0 -0
  18. package/bin/{cjs/reciple → reciple}/classes/builders/SlashCommandBuilder.js +0 -0
  19. package/bin/{types/reciple → reciple}/flags.d.ts +0 -0
  20. package/bin/{cjs/reciple → reciple}/flags.js +0 -0
  21. package/bin/{types/reciple → reciple}/logger.d.ts +0 -0
  22. package/bin/{cjs/reciple → reciple}/logger.js +0 -0
  23. package/bin/{types/reciple → reciple}/modules.d.ts +0 -0
  24. package/bin/{cjs/reciple → reciple}/modules.js +0 -0
  25. package/bin/{types/reciple → reciple}/permissions.d.ts +0 -0
  26. package/bin/{cjs/reciple → reciple}/permissions.js +0 -0
  27. package/bin/{types/reciple → reciple}/registerApplicationCommands.d.ts +0 -0
  28. package/bin/{cjs/reciple → reciple}/registerApplicationCommands.js +0 -0
  29. package/bin/{types/reciple → reciple}/types/builders.d.ts +0 -0
  30. package/bin/{cjs/reciple → reciple}/types/builders.js +0 -0
  31. package/bin/{types/reciple → reciple}/types/commands.d.ts +0 -0
  32. package/bin/{cjs/reciple → reciple}/types/commands.js +0 -0
  33. package/bin/{types/reciple → reciple}/types/paramOptions.d.ts +0 -0
  34. package/bin/{cjs/reciple → reciple}/types/paramOptions.js +0 -0
  35. package/bin/{types/reciple → reciple}/util.d.ts +0 -0
  36. package/bin/{cjs/reciple → reciple}/util.js +0 -0
  37. package/bin/{types/reciple → reciple}/version.d.ts +0 -0
  38. package/bin/{cjs/reciple → reciple}/version.js +0 -0
  39. package/package.json +5 -10
  40. package/bin/cjs/package.json +0 -3
  41. package/bin/mjs/bin.js +0 -46
  42. package/bin/mjs/index.js +0 -17
  43. package/bin/mjs/package.json +0 -3
  44. package/bin/mjs/reciple/classes/CommandCooldownManager.js +0 -87
  45. package/bin/mjs/reciple/classes/MessageCommandOptionManager.js +0 -21
  46. package/bin/mjs/reciple/classes/RecipleClient.js +0 -363
  47. package/bin/mjs/reciple/classes/RecipleConfig.js +0 -92
  48. package/bin/mjs/reciple/classes/builders/MessageCommandBuilder.js +0 -218
  49. package/bin/mjs/reciple/classes/builders/MessageCommandOptionBuilder.js +0 -67
  50. package/bin/mjs/reciple/classes/builders/SlashCommandBuilder.js +0 -204
  51. package/bin/mjs/reciple/flags.js +0 -28
  52. package/bin/mjs/reciple/logger.js +0 -28
  53. package/bin/mjs/reciple/modules.js +0 -81
  54. package/bin/mjs/reciple/permissions.js +0 -23
  55. package/bin/mjs/reciple/registerApplicationCommands.js +0 -47
  56. package/bin/mjs/reciple/types/builders.js +0 -8
  57. package/bin/mjs/reciple/types/commands.js +0 -12
  58. package/bin/mjs/reciple/types/paramOptions.js +0 -1
  59. package/bin/mjs/reciple/util.js +0 -7
  60. package/bin/mjs/reciple/version.js +0 -38
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/package.json CHANGED
@@ -1,18 +1,13 @@
1
1
  {
2
2
  "name": "reciple",
3
- "version": "5.4.1-pre.3",
3
+ "version": "5.4.1",
4
+ "bin": "bin/bin.js",
4
5
  "license": "GPL-3.0",
5
- "typings": "bin/types/index.d.ts",
6
+ "main": "bin/index.js",
7
+ "typings": "bin/index.d.ts",
6
8
  "author": "FalloutStudios",
7
9
  "description": "Handler for Discord.js",
8
10
  "homepage": "https://reciple.js.org",
9
- "main": "./bin/cjs/index.js",
10
- "module": "./bin/mjs/index.js",
11
- "bin": "./bin/cjs/bin.js",
12
- "exports": {
13
- "import": "./bin/mjs/index.js",
14
- "require": "./bin/cjs/index.js"
15
- },
16
11
  "keywords": [
17
12
  "Discord",
18
13
  "Discord.js handler",
@@ -26,7 +21,7 @@
26
21
  },
27
22
  "scripts": {
28
23
  "clean": "yarn exec rimraf bin",
29
- "build": "yarn clean && echo Building commonjs && yarn exec tsc -p ./tsconfigs/tsconfig-cjs.json && echo Building mjs && yarn exec tsc -p ./tsconfigs/tsconfig-mjs.json && node ./tsconfigs/package.json.js",
24
+ "build": "yarn clean && yarn exec tsc",
30
25
  "build:publish": "yarn build && yarn npm publish && yarn build:docs && yarn publish:docs",
31
26
  "build:publish-prerelease": "yarn build && yarn npm publish --tag pre",
32
27
  "build:docs": "yarn exec typedoc --tsconfig ./docs/typedoc.json",
@@ -1,3 +0,0 @@
1
- {
2
- "type": "commonjs"
3
- }
package/bin/mjs/bin.js DELETED
@@ -1,46 +0,0 @@
1
- #!/usr/bin/env node
2
- import { RecipleClient } from './reciple/classes/RecipleClient.js';
3
- import { RecipleConfig } from './reciple/classes/RecipleConfig.js';
4
- import { rawVersion } from './reciple/version.js';
5
- import { existsSync, readdirSync } from 'fs.js';
6
- import { cwd, flags } from './reciple/flags.js';
7
- import { input } from 'fallout-utility.js';
8
- import chalk from 'chalk.js';
9
- import 'dotenv/config';
10
- import { normalizeArray } from 'discord.js.js';
11
- import path from 'path.js';
12
- const allowedFiles = ['node_modules', 'reciple.yml', 'package.json'];
13
- const configPath = path.join(cwd, './reciple.yml');
14
- if (readdirSync(cwd).filter(f => !f.startsWith('.') && allowedFiles.indexOf(f)).length > 0 && !existsSync(flags.config ?? configPath)) {
15
- const ask = (flags.yes ? 'y' : null) ?? input('This directory does not contain reciple.yml. Would you like to init axis here? [y/n] ') ?? '';
16
- if (ask.toString().toLowerCase() !== 'y')
17
- process.exit(0);
18
- }
19
- let configParser;
20
- try {
21
- configParser = new RecipleConfig(flags.config ?? configPath).parseConfig();
22
- }
23
- catch (err) {
24
- console.error(`${chalk.bold.red('Config Error')}: ${chalk.white(err.message)}`);
25
- process.exit(1);
26
- }
27
- const config = configParser.getConfig();
28
- const client = new RecipleClient({ config: config, ...config.client });
29
- if (config.fileLogging.clientLogs)
30
- client.logger.info('Starting Reciple client v' + rawVersion);
31
- (async () => {
32
- await client.startModules(normalizeArray(config.modulesFolder));
33
- client.on('ready', async () => {
34
- if (client.isClientLogsEnabled())
35
- client.logger.warn(`Logged in as ${client.user?.tag || 'Unknown'}!`);
36
- client.on('cacheSweep', () => {
37
- client.cooldowns.clean();
38
- });
39
- await client.loadModules();
40
- client.addCommandListeners();
41
- });
42
- client.login(config.token).catch(err => {
43
- if (client.isClientLogsEnabled())
44
- client.logger.error(err);
45
- });
46
- })();
package/bin/mjs/index.js DELETED
@@ -1,17 +0,0 @@
1
- export * from './reciple/classes/CommandCooldownManager';
2
- export * from './reciple/classes/MessageCommandOptionManager';
3
- export * from './reciple/classes/RecipleClient';
4
- export * from './reciple/classes/RecipleConfig';
5
- export * from './reciple/classes/builders/MessageCommandBuilder';
6
- export * from './reciple/classes/builders/MessageCommandOptionBuilder';
7
- export * from './reciple/classes/builders/SlashCommandBuilder';
8
- export * from './reciple/types/builders';
9
- export * from './reciple/types/commands';
10
- export * from './reciple/types/paramOptions';
11
- export * from './reciple/flags';
12
- export * from './reciple/logger';
13
- export * from './reciple/modules';
14
- export * from './reciple/permissions';
15
- export * from './reciple/registerApplicationCommands';
16
- export * from './reciple/util';
17
- export * from './reciple/version';
@@ -1,3 +0,0 @@
1
- {
2
- "type": "module"
3
- }
@@ -1,87 +0,0 @@
1
- import { normalizeArray } from 'discord.js.js';
2
- /**
3
- * cooled-down users manager
4
- */
5
- export class CommandCooldownManager extends Array {
6
- constructor(...data) {
7
- super(...normalizeArray(data));
8
- }
9
- /**
10
- * Alias for `CommandCooldownManager#push()`
11
- * @param options Cooled-down user data
12
- */
13
- add(...options) {
14
- return this.push(...options);
15
- }
16
- /**
17
- * Remove cooldown from specific user, channel or guild
18
- * @param options Remove cooldown data options
19
- * @param limit Remove cooldown data limit
20
- */
21
- remove(options, limit = 0) {
22
- if (!Object.keys(options).length)
23
- throw new TypeError('Provide atleast one option to remove cooldown data.');
24
- let i = 0;
25
- for (const index in this) {
26
- if (!CommandCooldownManager.checkOptions(options, this[index]))
27
- continue;
28
- if (options.expireTime && this[index].expireTime > Date.now())
29
- continue;
30
- if (limit && i >= limit)
31
- continue;
32
- this.splice(Number(index));
33
- i++;
34
- }
35
- }
36
- /**
37
- * Check if the given user is cooled-down
38
- * @param options Options to identify if user is on cooldown
39
- */
40
- isCooledDown(options) {
41
- const data = this.get(options);
42
- if (!data)
43
- return false;
44
- this.remove({ ...data, channel: undefined, guild: undefined, type: undefined, command: undefined });
45
- if (data.expireTime < Date.now())
46
- return false;
47
- return true;
48
- }
49
- /**
50
- * Purge non cooled-down users from this array
51
- * @param options Clean cooldown options
52
- */
53
- clean(options) {
54
- for (const index in this) {
55
- if (options && !CommandCooldownManager.checkOptions(options, this[index]))
56
- return;
57
- if (this[index].expireTime > Date.now())
58
- return;
59
- this.slice(Number(index));
60
- }
61
- }
62
- /**
63
- * Get someone's cooldown data
64
- * @param options Get cooldown data options
65
- */
66
- get(options) {
67
- return this.find(data => CommandCooldownManager.checkOptions(options, data));
68
- }
69
- /**
70
- * Check if the options are valid
71
- * @param options Options to validated
72
- * @param data Cooled-down user data
73
- */
74
- static checkOptions(options, data) {
75
- if (options?.user && options.user.id !== data.user.id)
76
- return false;
77
- if (options?.guild && options.guild.id !== data.guild?.id)
78
- return false;
79
- if (options?.channel && options.channel.id !== data.channel?.id)
80
- return false;
81
- if (options?.command && options.command !== data.command)
82
- return false;
83
- if (options?.type && options.type !== data.type)
84
- return false;
85
- return true;
86
- }
87
- }
@@ -1,21 +0,0 @@
1
- import { normalizeArray } from 'discord.js.js';
2
- /**
3
- * Validated message options manager
4
- */
5
- export class MessageCommandOptionManager extends Array {
6
- constructor(...data) {
7
- super(...normalizeArray(data));
8
- }
9
- get(name, required) {
10
- const option = this.find(o => o.name == name);
11
- if (!option?.value == undefined && required)
12
- throw new TypeError(`Can't find option named ${name}`);
13
- return option ?? null;
14
- }
15
- getValue(name, requied) {
16
- const option = this.get(name, requied);
17
- if (!option?.value && requied)
18
- throw new TypeError(`Value of option named ${name} is undefined`);
19
- return option?.value ?? null;
20
- }
21
- }