xernerx 4.17.9 → 5.0.2
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.
- package/README.md +14 -67
- package/dist/main.cjs +63 -0
- package/dist/main.cjs.map +1 -0
- package/dist/main.d.cts +21 -0
- package/dist/main.d.ts +18 -37
- package/dist/main.js +23 -42
- package/dist/main.js.map +1 -0
- package/package.json +63 -48
- package/src/main.ts +26 -0
- package/dist/build/XernerxContextCommand.d.ts +0 -54
- package/dist/build/XernerxContextCommand.js +0 -121
- package/dist/build/XernerxEvent.d.ts +0 -21
- package/dist/build/XernerxEvent.js +0 -27
- package/dist/build/XernerxInhibitor.d.ts +0 -29
- package/dist/build/XernerxInhibitor.js +0 -27
- package/dist/build/XernerxMessageCommand.d.ts +0 -58
- package/dist/build/XernerxMessageCommand.js +0 -119
- package/dist/build/XernerxSlashCommand.d.ts +0 -70
- package/dist/build/XernerxSlashCommand.js +0 -178
- package/dist/client/XernerxClient.d.ts +0 -64
- package/dist/client/XernerxClient.js +0 -109
- package/dist/client/XernerxShardClient.d.ts +0 -21
- package/dist/client/XernerxShardClient.js +0 -54
- package/dist/functions/deploy.d.ts +0 -3
- package/dist/functions/deploy.js +0 -63
- package/dist/functions/load.d.ts +0 -4
- package/dist/functions/load.js +0 -35
- package/dist/functions/reload.d.ts +0 -3
- package/dist/functions/reload.js +0 -30
- package/dist/functions/setPresence.d.ts +0 -4
- package/dist/functions/setPresence.js +0 -21
- package/dist/handlers/CommandHandler.d.ts +0 -16
- package/dist/handlers/CommandHandler.js +0 -351
- package/dist/handlers/EventHandler.d.ts +0 -11
- package/dist/handlers/EventHandler.js +0 -84
- package/dist/handlers/ExtensionHandler.d.ts +0 -9
- package/dist/handlers/ExtensionHandler.js +0 -29
- package/dist/handlers/Handler.d.ts +0 -26
- package/dist/handlers/Handler.js +0 -64
- package/dist/handlers/InhibitorHandler.d.ts +0 -9
- package/dist/handlers/InhibitorHandler.js +0 -31
- package/dist/handlers/IntegrationHandler.d.ts +0 -15
- package/dist/handlers/IntegrationHandler.js +0 -26
- package/dist/models/Arguments.d.ts +0 -9
- package/dist/models/Arguments.js +0 -154
- package/dist/models/Cooldowns.d.ts +0 -11
- package/dist/models/Cooldowns.js +0 -33
- package/dist/models/XernerxEntitlement.d.ts +0 -45
- package/dist/models/XernerxEntitlement.js +0 -57
- package/dist/models/XernerxUser.d.ts +0 -14
- package/dist/models/XernerxUser.js +0 -13
- package/dist/tools/XernerxError.d.ts +0 -7
- package/dist/tools/XernerxError.js +0 -11
- package/dist/tools/XernerxIntents.d.ts +0 -6
- package/dist/tools/XernerxIntents.js +0 -26
- package/dist/tools/XernerxLog.d.ts +0 -31
- package/dist/tools/XernerxLog.js +0 -139
- package/dist/tools/XernerxText.d.ts +0 -31
- package/dist/tools/XernerxText.js +0 -94
- package/dist/types/extenders.d.ts +0 -76
- package/dist/types/extenders.js +0 -2
- package/dist/types/interfaces.d.ts +0 -258
- package/dist/types/interfaces.js +0 -2
- package/dist/types/types.d.ts +0 -12
- package/dist/types/types.js +0 -2
- package/dist/utils/ClientUtil.d.ts +0 -20
- package/dist/utils/ClientUtil.js +0 -123
- package/dist/utils/InteractionUtil.d.ts +0 -25
- package/dist/utils/InteractionUtil.js +0 -153
- package/dist/utils/MessageUtil.d.ts +0 -26
- package/dist/utils/MessageUtil.js +0 -167
- package/dist/utils/Util.d.ts +0 -12
- package/dist/utils/Util.js +0 -11
- package/dist/validators/commandValidation.d.ts +0 -7
- package/dist/validators/commandValidation.js +0 -124
- package/dist/validators/inhibitorValidations.d.ts +0 -9
- package/dist/validators/inhibitorValidations.js +0 -44
- package/tsup.config.ts +0 -19
package/README.md
CHANGED
|
@@ -1,76 +1,23 @@
|
|
|
1
1
|
<!-- @format -->
|
|
2
|
-
<center>
|
|
3
2
|
|
|
4
|
-
|
|
3
|
+
# xernerx
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-

|
|
8
|
-

|
|
9
|
-

|
|
10
|
-

|
|
11
|
-

|
|
12
|
-
[](https://wakatime.com/badge/user/0eeef1b5-98a7-4ec0-ab4c-db00536d5ed1/project/23ab34b7-623b-45e8-b8db-e9f1910589f7)
|
|
13
|
-

|
|
14
|
-

|
|
5
|
+
The official all-in-one **Xernerx** meta-package, re-exporting all `@xernerx/*` packages from a single entry point:
|
|
15
6
|
|
|
16
|
-
|
|
17
|
-
|
|
7
|
+
- [`@xernerx/framework`](https://www.npmjs.com/package/@xernerx/framework) — Discord bot framework (`XernerxClient`, `XernerxShardClient`, command/event/inhibitor builders & handlers)
|
|
8
|
+
- [`@xernerx/commands`](https://www.npmjs.com/package/@xernerx/commands) — Developer command extension & Xernerx Suite Commands API SDK (`XernerxCommands`, `CommandsClient`, `postCommands`)
|
|
9
|
+
- [`@xernerx/stats`](https://www.npmjs.com/package/@xernerx/stats) — Xernerx Suite Stats API SDK (`XernerxStats`, `StatsClient`, `postStats`)
|
|
10
|
+
- [`@xernerx/terminal`](https://www.npmjs.com/package/@xernerx/terminal) — Formatted CLI logger & interactive spinner (`Terminal`, `terminal`, `Spinner`)
|
|
11
|
+
- [`@xernerx/websocket`](https://www.npmjs.com/package/@xernerx/websocket) — Xernerx Suite WebSocket client (`XernerxWebsocket`)
|
|
18
12
|
|
|
19
|
-
|
|
13
|
+
## Installation
|
|
20
14
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
## Features
|
|
24
|
-
|
|
25
|
-
> - [x] Slash command handler
|
|
26
|
-
> - [x] Message command handler
|
|
27
|
-
> - [x] Context command handler
|
|
28
|
-
> - [x] Event handler (with custom Events)
|
|
29
|
-
> - [x] Inhibitor handler
|
|
30
|
-
> - [x] Extension handler
|
|
31
|
-
> - [x] Client Utilities
|
|
32
|
-
> - [x] Message Utilities
|
|
33
|
-
> - [x] Interaction Utilities
|
|
34
|
-
> - [x] Message command handles
|
|
35
|
-
> - [x] Extension support
|
|
36
|
-
> - [x] ShardClient
|
|
37
|
-
|
|
38
|
-
## Links
|
|
39
|
-
|
|
40
|
-
> - [Documentation](https://xernerx.github.io/xernerx/docs/#v4)
|
|
41
|
-
> - [Guide](https://xernerx.github.io/xernerx/guide/#v4)
|
|
42
|
-
|
|
43
|
-
## Setup
|
|
44
|
-
|
|
45
|
-
### Settings
|
|
46
|
-
|
|
47
|
-
```js
|
|
48
|
-
import XernerxClient from 'xernerx';
|
|
49
|
-
|
|
50
|
-
new (class Client extends XernerxClient {
|
|
51
|
-
constructor() {
|
|
52
|
-
super([discordOptions], [xernerxOptions]);
|
|
53
|
-
|
|
54
|
-
this.connect('token');
|
|
55
|
-
}
|
|
56
|
-
})();
|
|
15
|
+
```bash
|
|
16
|
+
pnpm add xernerx discord.js @discordjs/core
|
|
57
17
|
```
|
|
58
18
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
There are 5 handlers total
|
|
62
|
-
|
|
63
|
-
> - Command handler, handles message, slash and context commands
|
|
64
|
-
> - Event handler, has all the Discord.js events and more
|
|
65
|
-
> - Inhibitor handler, handles conditions before commands are ran globally
|
|
66
|
-
> - Extension handler, more info [here](#Extensions)
|
|
67
|
-
> - Webhook handler, will allow for top.gg to get your stats (needs a rework)
|
|
68
|
-
|
|
69
|
-
## Extensions
|
|
19
|
+
## Usage
|
|
70
20
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
- Only compatible with ESM
|
|
76
|
-
- TypeScript and JavaScript support
|
|
21
|
+
```ts
|
|
22
|
+
import { XernerxClient, XernerxCommands, XernerxStats, XernerxWebsocket, terminal } from 'xernerx';
|
|
23
|
+
```
|
package/dist/main.cjs
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var framework = require('@xernerx/framework');
|
|
4
|
+
var terminal = require('@xernerx/terminal');
|
|
5
|
+
var websocket = require('@xernerx/websocket');
|
|
6
|
+
var stats = require('@xernerx/stats');
|
|
7
|
+
var commands = require('@xernerx/commands');
|
|
8
|
+
|
|
9
|
+
var __defProp = Object.defineProperty;
|
|
10
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
11
|
+
async function post(data, token, baseUrl) {
|
|
12
|
+
if (data && typeof data === "object" && "commands" in data) {
|
|
13
|
+
return commands.post(data, token, baseUrl);
|
|
14
|
+
}
|
|
15
|
+
return stats.post(data, token, baseUrl);
|
|
16
|
+
}
|
|
17
|
+
__name(post, "post");
|
|
18
|
+
|
|
19
|
+
Object.defineProperty(exports, "BaseClient", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function () { return stats.BaseClient; }
|
|
22
|
+
});
|
|
23
|
+
Object.defineProperty(exports, "postStats", {
|
|
24
|
+
enumerable: true,
|
|
25
|
+
get: function () { return stats.post; }
|
|
26
|
+
});
|
|
27
|
+
Object.defineProperty(exports, "postCommands", {
|
|
28
|
+
enumerable: true,
|
|
29
|
+
get: function () { return commands.post; }
|
|
30
|
+
});
|
|
31
|
+
exports.post = post;
|
|
32
|
+
Object.keys(framework).forEach(function (k) {
|
|
33
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
34
|
+
enumerable: true,
|
|
35
|
+
get: function () { return framework[k]; }
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
Object.keys(terminal).forEach(function (k) {
|
|
39
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
40
|
+
enumerable: true,
|
|
41
|
+
get: function () { return terminal[k]; }
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
Object.keys(websocket).forEach(function (k) {
|
|
45
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
46
|
+
enumerable: true,
|
|
47
|
+
get: function () { return websocket[k]; }
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
Object.keys(stats).forEach(function (k) {
|
|
51
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
52
|
+
enumerable: true,
|
|
53
|
+
get: function () { return stats[k]; }
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
Object.keys(commands).forEach(function (k) {
|
|
57
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
58
|
+
enumerable: true,
|
|
59
|
+
get: function () { return commands[k]; }
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
//# sourceMappingURL=main.cjs.map
|
|
63
|
+
//# sourceMappingURL=main.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/main.ts"],"names":["postCommands","postStats"],"mappings":";;;;;;;;;;AAoBA,eAAsB,IAAA,CAAK,IAAA,EAAsC,KAAA,EAAe,OAAA,EAAgC;AAC/G,EAAA,IAAI,IAAA,IAAQ,OAAO,IAAA,KAAS,QAAA,IAAY,cAAc,IAAA,EAAM;AAC3D,IAAA,OAAOA,aAAA,CAAa,IAAA,EAAM,KAAA,EAAO,OAAO,CAAA;AAAA,EACzC;AACA,EAAA,OAAOC,UAAA,CAAU,IAAA,EAAsB,KAAA,EAAO,OAAO,CAAA;AACtD;AALsB,MAAA,CAAA,IAAA,EAAA,MAAA,CAAA","file":"main.cjs","sourcesContent":["/** @format */\n// Re-exports all @xernerx/* packages\n\nexport * from '@xernerx/framework';\nexport * from '@xernerx/terminal';\nexport * from '@xernerx/websocket';\nexport * from '@xernerx/stats';\nexport * from '@xernerx/commands';\n\nimport { BaseClient, type BaseClientOptions, post as postStats, type StatsPayload } from '@xernerx/stats';\nimport { post as postCommands, type CommandsPayload } from '@xernerx/commands';\n\nexport { BaseClient, type BaseClientOptions, postStats, postCommands };\n\n/**\n * Posts either bot statistics (`StatsPayload`) or bot commands (`CommandsPayload`) to the Xernerx Suite API.\n * @param data - Statistics payload or commands payload.\n * @param token - Xernerx API bearer token.\n * @param baseUrl - Optional custom API base URL.\n */\nexport async function post(data: StatsPayload | CommandsPayload, token: string, baseUrl?: string): Promise<any> {\n\tif (data && typeof data === 'object' && 'commands' in data) {\n\t\treturn postCommands(data, token, baseUrl);\n\t}\n\treturn postStats(data as StatsPayload, token, baseUrl);\n}\n"]}
|
package/dist/main.d.cts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export * from '@xernerx/framework';
|
|
2
|
+
export * from '@xernerx/terminal';
|
|
3
|
+
export * from '@xernerx/websocket';
|
|
4
|
+
import { StatsPayload } from '@xernerx/stats';
|
|
5
|
+
export * from '@xernerx/stats';
|
|
6
|
+
export { BaseClient, BaseClientOptions, post as postStats } from '@xernerx/stats';
|
|
7
|
+
import { CommandsPayload } from '@xernerx/commands';
|
|
8
|
+
export * from '@xernerx/commands';
|
|
9
|
+
export { post as postCommands } from '@xernerx/commands';
|
|
10
|
+
|
|
11
|
+
/** @format */
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Posts either bot statistics (`StatsPayload`) or bot commands (`CommandsPayload`) to the Xernerx Suite API.
|
|
15
|
+
* @param data - Statistics payload or commands payload.
|
|
16
|
+
* @param token - Xernerx API bearer token.
|
|
17
|
+
* @param baseUrl - Optional custom API base URL.
|
|
18
|
+
*/
|
|
19
|
+
declare function post(data: StatsPayload | CommandsPayload, token: string, baseUrl?: string): Promise<any>;
|
|
20
|
+
|
|
21
|
+
export { post };
|
package/dist/main.d.ts
CHANGED
|
@@ -1,40 +1,21 @@
|
|
|
1
|
+
export * from '@xernerx/framework';
|
|
2
|
+
export * from '@xernerx/terminal';
|
|
3
|
+
export * from '@xernerx/websocket';
|
|
4
|
+
import { StatsPayload } from '@xernerx/stats';
|
|
5
|
+
export * from '@xernerx/stats';
|
|
6
|
+
export { BaseClient, BaseClientOptions, post as postStats } from '@xernerx/stats';
|
|
7
|
+
import { CommandsPayload } from '@xernerx/commands';
|
|
8
|
+
export * from '@xernerx/commands';
|
|
9
|
+
export { post as postCommands } from '@xernerx/commands';
|
|
10
|
+
|
|
1
11
|
/** @format */
|
|
2
|
-
|
|
3
|
-
import XernerxClient from './client/XernerxClient.js';
|
|
4
|
-
import XernerxShardClient from './client/XernerxShardClient.js';
|
|
5
|
-
import XernerxMessageCommand from './build/XernerxMessageCommand.js';
|
|
6
|
-
import XernerxSlashCommand from './build/XernerxSlashCommand.js';
|
|
7
|
-
import XernerxContextCommand from './build/XernerxContextCommand.js';
|
|
8
|
-
import XernerxEvent from './build/XernerxEvent.js';
|
|
9
|
-
import XernerxInhibitor from './build/XernerxInhibitor.js';
|
|
10
|
-
import XernerxLog from './tools/XernerxLog.js';
|
|
11
|
-
export { XernerxIntents } from './tools/XernerxIntents.js';
|
|
12
|
-
export * from 'discord.js';
|
|
13
|
-
export * from 'dumfunctions';
|
|
14
|
-
import * as Discord from 'discord.js';
|
|
15
|
-
import XernerxExtension from 'xernerx-extension-builder';
|
|
16
|
-
export * from './types/types.js';
|
|
17
|
-
export * from './types/extenders.js';
|
|
18
|
-
export * from './types/interfaces.js';
|
|
19
|
-
export default XernerxClient;
|
|
20
|
-
export {
|
|
12
|
+
|
|
21
13
|
/**
|
|
22
|
-
|
|
14
|
+
* Posts either bot statistics (`StatsPayload`) or bot commands (`CommandsPayload`) to the Xernerx Suite API.
|
|
15
|
+
* @param data - Statistics payload or commands payload.
|
|
16
|
+
* @param token - Xernerx API bearer token.
|
|
17
|
+
* @param baseUrl - Optional custom API base URL.
|
|
23
18
|
*/
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
*/
|
|
28
|
-
XernerxMessageCommand, XernerxSlashCommand, XernerxContextCommand, XernerxEvent, XernerxInhibitor, XernerxExtension,
|
|
29
|
-
/**
|
|
30
|
-
** Imported exports
|
|
31
|
-
*/
|
|
32
|
-
Discord,
|
|
33
|
-
/**
|
|
34
|
-
** Properties
|
|
35
|
-
*/
|
|
36
|
-
version,
|
|
37
|
-
/**
|
|
38
|
-
** Tools
|
|
39
|
-
*/
|
|
40
|
-
XernerxLog, };
|
|
19
|
+
declare function post(data: StatsPayload | CommandsPayload, token: string, baseUrl?: string): Promise<any>;
|
|
20
|
+
|
|
21
|
+
export { post };
|
package/dist/main.js
CHANGED
|
@@ -1,42 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
export
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
** Clients
|
|
25
|
-
*/
|
|
26
|
-
XernerxClient, XernerxShardClient,
|
|
27
|
-
/**
|
|
28
|
-
** Builders
|
|
29
|
-
*/
|
|
30
|
-
XernerxMessageCommand, XernerxSlashCommand, XernerxContextCommand, XernerxEvent, XernerxInhibitor, XernerxExtension,
|
|
31
|
-
/**
|
|
32
|
-
** Imported exports
|
|
33
|
-
*/
|
|
34
|
-
Discord,
|
|
35
|
-
/**
|
|
36
|
-
** Properties
|
|
37
|
-
*/
|
|
38
|
-
version,
|
|
39
|
-
/**
|
|
40
|
-
** Tools
|
|
41
|
-
*/
|
|
42
|
-
XernerxLog, };
|
|
1
|
+
export * from '@xernerx/framework';
|
|
2
|
+
export * from '@xernerx/terminal';
|
|
3
|
+
export * from '@xernerx/websocket';
|
|
4
|
+
import { post as post$2 } from '@xernerx/stats';
|
|
5
|
+
export * from '@xernerx/stats';
|
|
6
|
+
export { BaseClient, post as postStats } from '@xernerx/stats';
|
|
7
|
+
import { post as post$1 } from '@xernerx/commands';
|
|
8
|
+
export * from '@xernerx/commands';
|
|
9
|
+
export { post as postCommands } from '@xernerx/commands';
|
|
10
|
+
|
|
11
|
+
var __defProp = Object.defineProperty;
|
|
12
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
13
|
+
async function post(data, token, baseUrl) {
|
|
14
|
+
if (data && typeof data === "object" && "commands" in data) {
|
|
15
|
+
return post$1(data, token, baseUrl);
|
|
16
|
+
}
|
|
17
|
+
return post$2(data, token, baseUrl);
|
|
18
|
+
}
|
|
19
|
+
__name(post, "post");
|
|
20
|
+
|
|
21
|
+
export { post };
|
|
22
|
+
//# sourceMappingURL=main.js.map
|
|
23
|
+
//# sourceMappingURL=main.js.map
|
package/dist/main.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/main.ts"],"names":["postCommands","postStats"],"mappings":";;;;;;;;;;;;AAoBA,eAAsB,IAAA,CAAK,IAAA,EAAsC,KAAA,EAAe,OAAA,EAAgC;AAC/G,EAAA,IAAI,IAAA,IAAQ,OAAO,IAAA,KAAS,QAAA,IAAY,cAAc,IAAA,EAAM;AAC3D,IAAA,OAAOA,MAAA,CAAa,IAAA,EAAM,KAAA,EAAO,OAAO,CAAA;AAAA,EACzC;AACA,EAAA,OAAOC,MAAA,CAAU,IAAA,EAAsB,KAAA,EAAO,OAAO,CAAA;AACtD;AALsB,MAAA,CAAA,IAAA,EAAA,MAAA,CAAA","file":"main.js","sourcesContent":["/** @format */\n// Re-exports all @xernerx/* packages\n\nexport * from '@xernerx/framework';\nexport * from '@xernerx/terminal';\nexport * from '@xernerx/websocket';\nexport * from '@xernerx/stats';\nexport * from '@xernerx/commands';\n\nimport { BaseClient, type BaseClientOptions, post as postStats, type StatsPayload } from '@xernerx/stats';\nimport { post as postCommands, type CommandsPayload } from '@xernerx/commands';\n\nexport { BaseClient, type BaseClientOptions, postStats, postCommands };\n\n/**\n * Posts either bot statistics (`StatsPayload`) or bot commands (`CommandsPayload`) to the Xernerx Suite API.\n * @param data - Statistics payload or commands payload.\n * @param token - Xernerx API bearer token.\n * @param baseUrl - Optional custom API base URL.\n */\nexport async function post(data: StatsPayload | CommandsPayload, token: string, baseUrl?: string): Promise<any> {\n\tif (data && typeof data === 'object' && 'commands' in data) {\n\t\treturn postCommands(data, token, baseUrl);\n\t}\n\treturn postStats(data as StatsPayload, token, baseUrl);\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,60 +1,75 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xernerx",
|
|
3
|
-
"
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
"publishConfig": {
|
|
4
|
+
"access": "public"
|
|
5
|
+
},
|
|
6
|
+
"version": "5.0.2",
|
|
6
7
|
"type": "module",
|
|
7
|
-
"
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
"
|
|
14
|
-
"
|
|
8
|
+
"main": "./dist/main.cjs",
|
|
9
|
+
"module": "./dist/main.js",
|
|
10
|
+
"types": "./dist/main.d.ts",
|
|
11
|
+
"description": "The official all-in-one Xernerx Suite SDK and bot framework, re-exporting all @xernerx/* packages.",
|
|
12
|
+
"homepage": "www.xernerx.com",
|
|
13
|
+
"files": [
|
|
14
|
+
"src",
|
|
15
|
+
"dist"
|
|
15
16
|
],
|
|
16
|
-
"
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
"
|
|
17
|
+
"exports": {
|
|
18
|
+
"require": {
|
|
19
|
+
"types": "./dist/main.d.cts",
|
|
20
|
+
"default": "./dist/main.cjs"
|
|
21
|
+
},
|
|
22
|
+
"import": {
|
|
23
|
+
"types": "./dist/main.d.ts",
|
|
24
|
+
"default": "./dist/main.js"
|
|
25
|
+
}
|
|
22
26
|
},
|
|
23
27
|
"scripts": {
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"major": "npm run commit && npm version major && npm run tag && npm publish && git push",
|
|
31
|
-
"site": "git add docs && npm run commit && git push",
|
|
32
|
-
"write": "npm i && npm run build && npm run format",
|
|
33
|
-
"format": "npx prettier --write src dist",
|
|
34
|
-
"build": "npm run build:esm && npm run format",
|
|
35
|
-
"build:esm": "tsc",
|
|
36
|
-
"build:cjs": "tsc --module CommonJS --outDir dist/cjs"
|
|
37
|
-
},
|
|
38
|
-
"repository": {
|
|
39
|
-
"type": "git",
|
|
40
|
-
"url": "git+https://github.com/xernerx/xernerx.git"
|
|
41
|
-
},
|
|
42
|
-
"bugs": {
|
|
43
|
-
"url": "https://github.com/xernerx/xernerx/issues"
|
|
28
|
+
"commit": "prettier --write . && node -e \"const fs=require('fs'),cp=require('child_process');const has=fs.readdirSync('.changeset').some(f=>f.endsWith('.md')&&f.toLowerCase()!=='readme.md');cp.execSync(!process.stdin.isTTY&&has?'pnpm exec changeset status':'pnpm exec changeset',{stdio:'inherit'})\"",
|
|
29
|
+
"ship": "changeset version && pnpm run build && git add . && git commit -m \"chore: release\" && changeset tag && git push --follow-tags",
|
|
30
|
+
"docs": "typedoc",
|
|
31
|
+
"build": "pnpm i && tsup && attw --pack && pnpm run docs",
|
|
32
|
+
"dev": "pnpm i && pnpm link && tsup --watch",
|
|
33
|
+
"test": "pnpm install --engine-strict=true"
|
|
44
34
|
},
|
|
35
|
+
"keywords": [
|
|
36
|
+
"xernerx",
|
|
37
|
+
"framework",
|
|
38
|
+
"commands",
|
|
39
|
+
"stats",
|
|
40
|
+
"terminal",
|
|
41
|
+
"websocket"
|
|
42
|
+
],
|
|
43
|
+
"author": "Xernerx Studios",
|
|
44
|
+
"license": "MIT",
|
|
45
|
+
"packageManager": "pnpm@11.24.0",
|
|
45
46
|
"dependencies": {
|
|
46
|
-
"@
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"xernerx
|
|
51
|
-
|
|
47
|
+
"@xernerx/commands": "^0.2.3",
|
|
48
|
+
"@xernerx/framework": "^1.0.3",
|
|
49
|
+
"@xernerx/stats": "^1.0.12",
|
|
50
|
+
"@xernerx/terminal": "^1.1.14",
|
|
51
|
+
"@xernerx/websocket": "^0.4.15"
|
|
52
|
+
},
|
|
53
|
+
"peerDependencies": {
|
|
54
|
+
"@discordjs/core": ">=2.0.0",
|
|
55
|
+
"discord.js": ">=14.0.0"
|
|
52
56
|
},
|
|
53
57
|
"devDependencies": {
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
58
|
+
"@arethetypeswrong/cli": "^0.18.2",
|
|
59
|
+
"@changesets/cli": "^3.0.1",
|
|
60
|
+
"@discordjs/core": "2.2.2",
|
|
61
|
+
"@types/node": "^24",
|
|
62
|
+
"discord.js": "14.22.1",
|
|
63
|
+
"prettier": "^3.8.3",
|
|
64
|
+
"tslib": "^2.8.1",
|
|
65
|
+
"tsup": "^8.5.1",
|
|
66
|
+
"typedoc": "^0.28.20",
|
|
67
|
+
"typedoc-github-theme": "^0.4.0",
|
|
68
|
+
"typedoc-plugin-extras": "^4.0.1",
|
|
69
|
+
"typedoc-plugin-zod": "^1.4.3",
|
|
70
|
+
"typescript": "^6.0.3"
|
|
71
|
+
},
|
|
72
|
+
"engines": {
|
|
73
|
+
"node": ">=24"
|
|
59
74
|
}
|
|
60
75
|
}
|
package/src/main.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** @format */
|
|
2
|
+
// Re-exports all @xernerx/* packages
|
|
3
|
+
|
|
4
|
+
export * from '@xernerx/framework';
|
|
5
|
+
export * from '@xernerx/terminal';
|
|
6
|
+
export * from '@xernerx/websocket';
|
|
7
|
+
export * from '@xernerx/stats';
|
|
8
|
+
export * from '@xernerx/commands';
|
|
9
|
+
|
|
10
|
+
import { BaseClient, type BaseClientOptions, post as postStats, type StatsPayload } from '@xernerx/stats';
|
|
11
|
+
import { post as postCommands, type CommandsPayload } from '@xernerx/commands';
|
|
12
|
+
|
|
13
|
+
export { BaseClient, type BaseClientOptions, postStats, postCommands };
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Posts either bot statistics (`StatsPayload`) or bot commands (`CommandsPayload`) to the Xernerx Suite API.
|
|
17
|
+
* @param data - Statistics payload or commands payload.
|
|
18
|
+
* @param token - Xernerx API bearer token.
|
|
19
|
+
* @param baseUrl - Optional custom API base URL.
|
|
20
|
+
*/
|
|
21
|
+
export async function post(data: StatsPayload | CommandsPayload, token: string, baseUrl?: string): Promise<any> {
|
|
22
|
+
if (data && typeof data === 'object' && 'commands' in data) {
|
|
23
|
+
return postCommands(data, token, baseUrl);
|
|
24
|
+
}
|
|
25
|
+
return postStats(data as StatsPayload, token, baseUrl);
|
|
26
|
+
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/** @format */
|
|
2
|
-
import { ContextMenuCommandBuilder } from 'discord.js';
|
|
3
|
-
import { XernerxMessageContextInteraction, XernerxUserContextInteraction, XernerxClientType } from '../types/extenders.js';
|
|
4
|
-
import { ContextCommandArguments, ContextCommandOptions } from '../types/interfaces.js';
|
|
5
|
-
import InteractionUtil from '../utils/InteractionUtil.js';
|
|
6
|
-
export default class XernerxContextCommand {
|
|
7
|
-
readonly id: string;
|
|
8
|
-
readonly data: ContextMenuCommandBuilder;
|
|
9
|
-
readonly name: string;
|
|
10
|
-
readonly type: 'user' | 'message';
|
|
11
|
-
readonly description: string | null | undefined;
|
|
12
|
-
readonly usage: string | null | undefined;
|
|
13
|
-
readonly info: string | null | undefined;
|
|
14
|
-
readonly category: string | null | undefined;
|
|
15
|
-
readonly cooldown: number | null | undefined;
|
|
16
|
-
readonly channel: ("GuildText" | "DM" | "GuildVoice" | "GroupDM" | "GuildCategory" | "GuildAnnouncement" | "AnnouncementThread" | "PublicThread" | "PrivateThread" | "GuildStageVoice" | "GuildDirectory" | "GuildForum" | "GuildMedia" | "GuildNews" | "GuildNewsThread" | "GuildPublicThread" | "GuildPrivateThread")[] | null;
|
|
17
|
-
readonly global: boolean | undefined;
|
|
18
|
-
readonly ignore: {
|
|
19
|
-
owner?: boolean;
|
|
20
|
-
users?: Array<string>;
|
|
21
|
-
channels?: Array<string>;
|
|
22
|
-
guilds?: Array<string>;
|
|
23
|
-
voice?: boolean;
|
|
24
|
-
} | undefined;
|
|
25
|
-
readonly strict: {
|
|
26
|
-
owner?: boolean;
|
|
27
|
-
users?: Array<string>;
|
|
28
|
-
channels?: Array<string>;
|
|
29
|
-
guilds?: Array<string>;
|
|
30
|
-
voice?: boolean;
|
|
31
|
-
} | undefined;
|
|
32
|
-
readonly permissions: {
|
|
33
|
-
user?: Array<import("../main.js").PermissionNames> | Array<string> | null;
|
|
34
|
-
client?: Array<import("../main.js").PermissionNames> | Array<string> | null;
|
|
35
|
-
dm?: boolean;
|
|
36
|
-
} | undefined;
|
|
37
|
-
readonly defer: {
|
|
38
|
-
reply?: boolean;
|
|
39
|
-
ephemeral?: boolean;
|
|
40
|
-
fetchReply?: boolean;
|
|
41
|
-
} | undefined;
|
|
42
|
-
readonly filetype: 'ContextCommand';
|
|
43
|
-
readonly filepath: string;
|
|
44
|
-
readonly client: XernerxClientType;
|
|
45
|
-
util: InteractionUtil;
|
|
46
|
-
snowflake: string | null;
|
|
47
|
-
constructor(id: string, options: ContextCommandOptions);
|
|
48
|
-
/**
|
|
49
|
-
* @description the execution of the command
|
|
50
|
-
* @param interaction - Interaction event emitted on command
|
|
51
|
-
* @param args - The arguments parsed with the command, if any
|
|
52
|
-
*/
|
|
53
|
-
exec<T = void>(interaction: XernerxUserContextInteraction | XernerxMessageContextInteraction, args: ContextCommandArguments<'user' | 'message'>): Promise<void | any | T>;
|
|
54
|
-
}
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
/** @format */
|
|
2
|
-
import { ContextMenuCommandBuilder } from 'discord.js';
|
|
3
|
-
import { z } from 'zod';
|
|
4
|
-
import XernerxLog from '../tools/XernerxLog.js';
|
|
5
|
-
export default class XernerxContextCommand {
|
|
6
|
-
constructor(id, options) {
|
|
7
|
-
this.id = id;
|
|
8
|
-
this.data = new ContextMenuCommandBuilder();
|
|
9
|
-
this.data.setName(options.name);
|
|
10
|
-
this.data.setNameLocalizations(options.nameLocalizations || null);
|
|
11
|
-
this.data.setType(options.type === 'user' ? 2 : 3);
|
|
12
|
-
this.data.setDMPermission(options.permissions?.dm || null);
|
|
13
|
-
options = z
|
|
14
|
-
.object({
|
|
15
|
-
name: z.string(),
|
|
16
|
-
type: z.enum(['user', 'message']),
|
|
17
|
-
description: z.string().or(z.null()).default(null),
|
|
18
|
-
usage: z.string().or(z.null()).default(null),
|
|
19
|
-
info: z.string().or(z.null()).default(null),
|
|
20
|
-
category: z.string().or(z.null()).default(null),
|
|
21
|
-
cooldown: z.number().or(z.null()).default(null),
|
|
22
|
-
global: z.boolean().default(true),
|
|
23
|
-
channel: z
|
|
24
|
-
.array(z.enum([
|
|
25
|
-
'GuildText',
|
|
26
|
-
'DM',
|
|
27
|
-
'GuildVoice',
|
|
28
|
-
'GroupDM',
|
|
29
|
-
'GuildCategory',
|
|
30
|
-
'GuildAnnouncement',
|
|
31
|
-
'AnnouncementThread',
|
|
32
|
-
'PublicThread',
|
|
33
|
-
'PrivateThread',
|
|
34
|
-
'GuildStageVoice',
|
|
35
|
-
'GuildDirectory',
|
|
36
|
-
'GuildForum',
|
|
37
|
-
'GuildNews',
|
|
38
|
-
'GuildNewsThread',
|
|
39
|
-
'GuildPublicThread',
|
|
40
|
-
'GuildPrivateThread',
|
|
41
|
-
]))
|
|
42
|
-
.or(z.enum([
|
|
43
|
-
'GuildText',
|
|
44
|
-
'DM',
|
|
45
|
-
'GuildVoice',
|
|
46
|
-
'GroupDM',
|
|
47
|
-
'GuildCategory',
|
|
48
|
-
'GuildAnnouncement',
|
|
49
|
-
'AnnouncementThread',
|
|
50
|
-
'PublicThread',
|
|
51
|
-
'PrivateThread',
|
|
52
|
-
'GuildStageVoice',
|
|
53
|
-
'GuildDirectory',
|
|
54
|
-
'GuildForum',
|
|
55
|
-
'GuildNews',
|
|
56
|
-
'GuildNewsThread',
|
|
57
|
-
'GuildPublicThread',
|
|
58
|
-
'GuildPrivateThread',
|
|
59
|
-
]))
|
|
60
|
-
.or(z.null())
|
|
61
|
-
.default(null),
|
|
62
|
-
ignore: z
|
|
63
|
-
.object({
|
|
64
|
-
owner: z.boolean().default(false),
|
|
65
|
-
users: z.array(z.string()).default([]),
|
|
66
|
-
channels: z.array(z.string()).default([]),
|
|
67
|
-
guilds: z.array(z.string()).default([]),
|
|
68
|
-
voice: z.boolean().default(false),
|
|
69
|
-
})
|
|
70
|
-
.default({}),
|
|
71
|
-
strict: z
|
|
72
|
-
.object({
|
|
73
|
-
owner: z.boolean().default(false),
|
|
74
|
-
users: z.array(z.string()).default([]),
|
|
75
|
-
channels: z.array(z.string()).default([]),
|
|
76
|
-
guilds: z.array(z.string()).default([]),
|
|
77
|
-
voice: z.boolean().default(false),
|
|
78
|
-
})
|
|
79
|
-
.default({}),
|
|
80
|
-
permissions: z
|
|
81
|
-
.object({
|
|
82
|
-
user: z.array(z.string()).or(z.null()).default(null),
|
|
83
|
-
client: z.array(z.string()).or(z.null()).default(null),
|
|
84
|
-
dm: z.boolean().default(true),
|
|
85
|
-
})
|
|
86
|
-
.default({}),
|
|
87
|
-
defer: z
|
|
88
|
-
.object({
|
|
89
|
-
reply: z.boolean().optional(),
|
|
90
|
-
ephemeral: z.boolean().optional(),
|
|
91
|
-
fetch: z.boolean().optional(),
|
|
92
|
-
})
|
|
93
|
-
.default({}),
|
|
94
|
-
})
|
|
95
|
-
.parse(options);
|
|
96
|
-
this.name = options.name;
|
|
97
|
-
this.type = options.type;
|
|
98
|
-
this.description = options.description;
|
|
99
|
-
this.usage = options.usage;
|
|
100
|
-
this.info = options.info;
|
|
101
|
-
this.category = options.category;
|
|
102
|
-
this.cooldown = options.cooldown;
|
|
103
|
-
this.channel = options.channel ? (Array.isArray(options.channel) ? options.channel : [options.channel]) : null;
|
|
104
|
-
this.global = options.global;
|
|
105
|
-
this.ignore = options.ignore;
|
|
106
|
-
this.strict = options.strict;
|
|
107
|
-
this.permissions = options.permissions;
|
|
108
|
-
this.defer = options.defer;
|
|
109
|
-
this.client = this.client;
|
|
110
|
-
this.util = this.util;
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* @description the execution of the command
|
|
114
|
-
* @param interaction - Interaction event emitted on command
|
|
115
|
-
* @param args - The arguments parsed with the command, if any
|
|
116
|
-
*/
|
|
117
|
-
async exec(interaction, args) {
|
|
118
|
-
new XernerxLog(this.client).error(`${this.id} doesn't have an execution rule.`);
|
|
119
|
-
return await this.client.emit('commandError', interaction, `${this.id} doesn't have an execution rule.`, this, this.filetype);
|
|
120
|
-
}
|
|
121
|
-
}
|