xernerx 4.5.6 → 4.5.8
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/dist/build/XernerxContextCommand.d.ts +46 -46
- package/dist/build/XernerxContextCommand.d.ts.map +1 -1
- package/dist/build/XernerxContextCommand.js +63 -63
- package/dist/build/XernerxContextCommand.js.map +1 -1
- package/dist/build/XernerxEvent.d.ts +16 -15
- package/dist/build/XernerxEvent.d.ts.map +1 -1
- package/dist/build/XernerxEvent.js +20 -20
- package/dist/build/XernerxEvent.js.map +1 -1
- package/dist/build/XernerxInhibitor.d.ts +19 -19
- package/dist/build/XernerxInhibitor.d.ts.map +1 -1
- package/dist/build/XernerxInhibitor.js +12 -12
- package/dist/build/XernerxInhibitor.js.map +1 -1
- package/dist/build/XernerxMessageCommand.d.ts +44 -44
- package/dist/build/XernerxMessageCommand.d.ts.map +1 -1
- package/dist/build/XernerxMessageCommand.js +57 -57
- package/dist/build/XernerxMessageCommand.js.map +1 -1
- package/dist/build/XernerxSlashCommand.d.ts +56 -56
- package/dist/build/XernerxSlashCommand.d.ts.map +1 -1
- package/dist/build/XernerxSlashCommand.js +109 -109
- package/dist/build/XernerxSlashCommand.js.map +1 -1
- package/dist/client/XernerxClient.d.ts +45 -44
- package/dist/client/XernerxClient.d.ts.map +1 -1
- package/dist/client/XernerxClient.js +74 -73
- package/dist/client/XernerxClient.js.map +1 -1
- package/dist/client/XernerxShardClient.d.ts +11 -10
- package/dist/client/XernerxShardClient.d.ts.map +1 -1
- package/dist/client/XernerxShardClient.js +49 -48
- package/dist/client/XernerxShardClient.js.map +1 -1
- package/dist/functions/deploy.d.ts +1 -0
- package/dist/functions/deploy.d.ts.map +1 -1
- package/dist/functions/deploy.js +31 -30
- package/dist/functions/deploy.js.map +1 -1
- package/dist/functions/load.d.ts +1 -0
- package/dist/functions/load.d.ts.map +1 -1
- package/dist/functions/load.js +28 -27
- package/dist/functions/load.js.map +1 -1
- package/dist/functions/reload.d.ts +1 -0
- package/dist/functions/reload.d.ts.map +1 -1
- package/dist/functions/reload.js +35 -34
- package/dist/functions/reload.js.map +1 -1
- package/dist/functions/sendWebhook.d.ts +1 -0
- package/dist/functions/sendWebhook.d.ts.map +1 -1
- package/dist/functions/sendWebhook.js +11 -10
- package/dist/functions/sendWebhook.js.map +1 -1
- package/dist/functions/setPresence.d.ts +1 -0
- package/dist/functions/setPresence.d.ts.map +1 -1
- package/dist/functions/setPresence.js +18 -17
- package/dist/functions/setPresence.js.map +1 -1
- package/dist/functions/xernerxUser.d.ts +1 -0
- package/dist/functions/xernerxUser.d.ts.map +1 -1
- package/dist/functions/xernerxUser.js +6 -8
- package/dist/functions/xernerxUser.js.map +1 -1
- package/dist/handlers/CommandHandler.d.ts +9 -8
- package/dist/handlers/CommandHandler.d.ts.map +1 -1
- package/dist/handlers/CommandHandler.js +240 -239
- package/dist/handlers/CommandHandler.js.map +1 -1
- package/dist/handlers/EventHandler.d.ts +3 -2
- package/dist/handlers/EventHandler.d.ts.map +1 -1
- package/dist/handlers/EventHandler.js +19 -18
- package/dist/handlers/EventHandler.js.map +1 -1
- package/dist/handlers/ExtensionHandler.d.ts +3 -2
- package/dist/handlers/ExtensionHandler.d.ts.map +1 -1
- package/dist/handlers/ExtensionHandler.js +18 -17
- package/dist/handlers/ExtensionHandler.js.map +1 -1
- package/dist/handlers/Handler.d.ts +8 -7
- package/dist/handlers/Handler.d.ts.map +1 -1
- package/dist/handlers/Handler.js +32 -31
- package/dist/handlers/Handler.js.map +1 -1
- package/dist/handlers/InhibitorHandler.d.ts +3 -2
- package/dist/handlers/InhibitorHandler.d.ts.map +1 -1
- package/dist/handlers/InhibitorHandler.js +19 -18
- package/dist/handlers/InhibitorHandler.js.map +1 -1
- package/dist/handlers/WebhookHandler.d.ts +4 -3
- package/dist/handlers/WebhookHandler.d.ts.map +1 -1
- package/dist/handlers/WebhookHandler.js +47 -46
- package/dist/handlers/WebhookHandler.js.map +1 -1
- package/dist/main.d.ts +27 -26
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +27 -26
- package/dist/main.js.map +1 -1
- package/dist/models/Arguments.d.ts +3 -2
- package/dist/models/Arguments.d.ts.map +1 -1
- package/dist/models/Arguments.js +135 -134
- package/dist/models/Arguments.js.map +1 -1
- package/dist/tools/XernerxError.d.ts +5 -4
- package/dist/tools/XernerxError.d.ts.map +1 -1
- package/dist/tools/XernerxError.js +9 -8
- package/dist/tools/XernerxError.js.map +1 -1
- package/dist/tools/XernerxLog.d.ts +13 -12
- package/dist/tools/XernerxLog.d.ts.map +1 -1
- package/dist/tools/XernerxLog.js +76 -80
- package/dist/tools/XernerxLog.js.map +1 -1
- package/dist/types/extenders.d.ts +43 -12
- package/dist/types/extenders.d.ts.map +1 -1
- package/dist/types/extenders.js +1 -0
- package/dist/types/extenders.js.map +1 -1
- package/dist/types/interfaces.d.ts +186 -172
- package/dist/types/interfaces.d.ts.map +1 -1
- package/dist/types/interfaces.js +1 -0
- package/dist/types/interfaces.js.map +1 -1
- package/dist/types/types.d.ts +172 -171
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/types.js +1 -0
- package/dist/types/types.js.map +1 -1
- package/dist/utils/ClientUtil.d.ts +13 -6
- package/dist/utils/ClientUtil.d.ts.map +1 -1
- package/dist/utils/ClientUtil.js +56 -26
- package/dist/utils/ClientUtil.js.map +1 -1
- package/dist/utils/InteractionUtil.d.ts +10 -5
- package/dist/utils/InteractionUtil.d.ts.map +1 -1
- package/dist/utils/InteractionUtil.js +97 -8
- package/dist/utils/InteractionUtil.js.map +1 -1
- package/dist/utils/MessageUtil.d.ts +13 -9
- package/dist/utils/MessageUtil.d.ts.map +1 -1
- package/dist/utils/MessageUtil.js +130 -37
- package/dist/utils/MessageUtil.js.map +1 -1
- package/dist/utils/Util.d.ts +4 -3
- package/dist/utils/Util.d.ts.map +1 -1
- package/dist/utils/Util.js +8 -7
- package/dist/utils/Util.js.map +1 -1
- package/dist/validators/commandValidation.d.ts +3 -2
- package/dist/validators/commandValidation.d.ts.map +1 -1
- package/dist/validators/commandValidation.js +43 -42
- package/dist/validators/commandValidation.js.map +1 -1
- package/dist/validators/inhibitorValidations.d.ts +15 -14
- package/dist/validators/inhibitorValidations.d.ts.map +1 -1
- package/dist/validators/inhibitorValidations.js +31 -30
- package/dist/validators/inhibitorValidations.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,22 +1,23 @@
|
|
|
1
|
+
/** @format */
|
|
1
2
|
import { XernerxContextCommand, XernerxMessageCommand, XernerxSlashCommand } from '../main.js';
|
|
2
3
|
import { XernerxMessage, XernerxMessageContextInteraction, XernerxSlashInteraction, XernerxUserContextInteraction } from '../types/extenders.js';
|
|
3
4
|
import { InhibitorType, XernerxInteraction } from '../types/types.js';
|
|
4
5
|
export declare function inhibitorValidation(
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
event: XernerxMessage | XernerxInteraction<XernerxSlashInteraction | XernerxUserContextInteraction | XernerxMessageContextInteraction>,
|
|
7
|
+
cmd?: XernerxContextCommand | XernerxMessageCommand | XernerxSlashCommand
|
|
7
8
|
): Promise<boolean>;
|
|
8
9
|
export declare function inhibitorArguments(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
event: XernerxMessage | XernerxInteraction<XernerxSlashInteraction | XernerxUserContextInteraction | XernerxMessageContextInteraction>,
|
|
11
|
+
cmd: XernerxContextCommand | XernerxMessageCommand | XernerxSlashCommand | null,
|
|
12
|
+
type: InhibitorType
|
|
12
13
|
):
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
| import('../main.js').XernerxUser
|
|
15
|
+
| import('discord.js').Guild
|
|
16
|
+
| import('discord.js').GuildMember
|
|
17
|
+
| import('discord.js').TextBasedChannel
|
|
18
|
+
| XernerxMessageCommand
|
|
19
|
+
| XernerxSlashCommand
|
|
20
|
+
| XernerxContextCommand
|
|
21
|
+
| import('../main.js').APIInteractionGuildMember
|
|
22
|
+
| null;
|
|
22
23
|
//# sourceMappingURL=inhibitorValidations.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inhibitorValidations.d.ts","sourceRoot":"","sources":["../../src/validators/inhibitorValidations.ts"],"names":[],"mappings":"AAAA,OAAsB,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAC9G,OAAO,EAAE,cAAc,EAAE,gCAAgC,EAAE,uBAAuB,EAAE,6BAA6B,EAAE,MAAM,uBAAuB,CAAC;AACjJ,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAEtE,wBAAsB,mBAAmB,
|
|
1
|
+
{"version":3,"file":"inhibitorValidations.d.ts","sourceRoot":"","sources":["../../src/validators/inhibitorValidations.ts"],"names":[],"mappings":"AAAA,cAAc;AAEd,OAAsB,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAC9G,OAAO,EAAE,cAAc,EAAE,gCAAgC,EAAE,uBAAuB,EAAE,6BAA6B,EAAE,MAAM,uBAAuB,CAAC;AACjJ,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAEtE,wBAAsB,mBAAmB,CACxC,KAAK,EAAE,cAAc,GAAG,kBAAkB,CAAC,uBAAuB,GAAG,6BAA6B,GAAG,gCAAgC,CAAC,EACtI,GAAG,CAAC,EAAE,qBAAqB,GAAG,qBAAqB,GAAG,mBAAmB,oBAazE;AAED,wBAAgB,kBAAkB,CACjC,KAAK,EAAE,cAAc,GAAG,kBAAkB,CAAC,uBAAuB,GAAG,6BAA6B,GAAG,gCAAgC,CAAC,EACtI,GAAG,EAAE,qBAAqB,GAAG,qBAAqB,GAAG,mBAAmB,GAAG,IAAI,EAC/E,IAAI,EAAE,aAAa,0QAwBnB"}
|
|
@@ -1,35 +1,36 @@
|
|
|
1
|
+
/** @format */
|
|
1
2
|
export async function inhibitorValidation(event, cmd) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
const client = event.client;
|
|
4
|
+
const inhibits = [];
|
|
5
|
+
for (const [name, inhibitor] of client.inhibitors) {
|
|
6
|
+
if (Boolean(await inhibitor.check(event, await inhibitorArguments(event, cmd || null, inhibitor.type)))) {
|
|
7
|
+
inhibits.push(name);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
return !!inhibits.length;
|
|
10
11
|
}
|
|
11
12
|
export function inhibitorArguments(event, cmd, type) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
13
|
+
switch (type) {
|
|
14
|
+
case 'channel':
|
|
15
|
+
return event.channel || null;
|
|
16
|
+
case 'command':
|
|
17
|
+
return cmd;
|
|
18
|
+
case 'contextCommand':
|
|
19
|
+
return cmd;
|
|
20
|
+
case 'guild':
|
|
21
|
+
return event.guild || null;
|
|
22
|
+
case 'interaction':
|
|
23
|
+
return null;
|
|
24
|
+
case 'member':
|
|
25
|
+
return event.member || null;
|
|
26
|
+
case 'message':
|
|
27
|
+
return null;
|
|
28
|
+
case 'messageCommand':
|
|
29
|
+
return cmd;
|
|
30
|
+
case 'slashCommand':
|
|
31
|
+
return cmd;
|
|
32
|
+
case 'user':
|
|
33
|
+
return event.user;
|
|
34
|
+
}
|
|
34
35
|
}
|
|
35
36
|
//# sourceMappingURL=inhibitorValidations.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inhibitorValidations.js","sourceRoot":"","sources":["../../src/validators/inhibitorValidations.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"inhibitorValidations.js","sourceRoot":"","sources":["../../src/validators/inhibitorValidations.ts"],"names":[],"mappings":"AAAA,cAAc;AAMd,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACxC,KAAsI,EACtI,GAAyE;IAEzE,MAAM,MAAM,GAAG,KAAK,CAAC,MAAuB,CAAC;IAE7C,MAAM,QAAQ,GAAG,EAAE,CAAC;IAEpB,KAAK,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,MAAM,CAAC,UAAU,EAAE;QAClD,IAAI,OAAO,CAAC,MAAM,SAAS,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,MAAM,kBAAkB,CAAC,KAAK,EAAE,GAAG,IAAI,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,CAAU,CAAC,CAAC,EAAE;YACnH,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SACpB;KACD;IAED,OAAO,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC;AAC1B,CAAC;AAED,MAAM,UAAU,kBAAkB,CACjC,KAAsI,EACtI,GAA+E,EAC/E,IAAmB;IAEnB,QAAQ,IAAI,EAAE;QACb,KAAK,SAAS;YACb,OAAO,KAAK,CAAC,OAAO,IAAI,IAAI,CAAC;QAC9B,KAAK,SAAS;YACb,OAAO,GAAG,CAAC;QACZ,KAAK,gBAAgB;YACpB,OAAO,GAAG,CAAC;QACZ,KAAK,OAAO;YACX,OAAO,KAAK,CAAC,KAAK,IAAI,IAAI,CAAC;QAC5B,KAAK,aAAa;YACjB,OAAO,IAAI,CAAC;QACb,KAAK,QAAQ;YACZ,OAAO,KAAK,CAAC,MAAM,IAAI,IAAI,CAAC;QAC7B,KAAK,SAAS;YACb,OAAO,IAAI,CAAC;QACb,KAAK,gBAAgB;YACpB,OAAO,GAAG,CAAC;QACZ,KAAK,cAAc;YAClB,OAAO,GAAG,CAAC;QACZ,KAAK,MAAM;YACV,OAAO,KAAK,CAAC,IAAI,CAAC;KACnB;AACF,CAAC","sourcesContent":["/** @format */\n\nimport XernerxClient, { XernerxContextCommand, XernerxMessageCommand, XernerxSlashCommand } from '../main.js';\nimport { XernerxMessage, XernerxMessageContextInteraction, XernerxSlashInteraction, XernerxUserContextInteraction } from '../types/extenders.js';\nimport { InhibitorType, XernerxInteraction } from '../types/types.js';\n\nexport async function inhibitorValidation(\n\tevent: XernerxMessage | XernerxInteraction<XernerxSlashInteraction | XernerxUserContextInteraction | XernerxMessageContextInteraction>,\n\tcmd?: XernerxContextCommand | XernerxMessageCommand | XernerxSlashCommand\n) {\n\tconst client = event.client as XernerxClient;\n\n\tconst inhibits = [];\n\n\tfor (const [name, inhibitor] of client.inhibitors) {\n\t\tif (Boolean(await inhibitor.check(event, (await inhibitorArguments(event, cmd || null, inhibitor.type)) as never))) {\n\t\t\tinhibits.push(name);\n\t\t}\n\t}\n\n\treturn !!inhibits.length;\n}\n\nexport function inhibitorArguments(\n\tevent: XernerxMessage | XernerxInteraction<XernerxSlashInteraction | XernerxUserContextInteraction | XernerxMessageContextInteraction>,\n\tcmd: XernerxContextCommand | XernerxMessageCommand | XernerxSlashCommand | null,\n\ttype: InhibitorType\n) {\n\tswitch (type) {\n\t\tcase 'channel':\n\t\t\treturn event.channel || null;\n\t\tcase 'command':\n\t\t\treturn cmd;\n\t\tcase 'contextCommand':\n\t\t\treturn cmd;\n\t\tcase 'guild':\n\t\t\treturn event.guild || null;\n\t\tcase 'interaction':\n\t\t\treturn null;\n\t\tcase 'member':\n\t\t\treturn event.member || null;\n\t\tcase 'message':\n\t\t\treturn null;\n\t\tcase 'messageCommand':\n\t\t\treturn cmd;\n\t\tcase 'slashCommand':\n\t\t\treturn cmd;\n\t\tcase 'user':\n\t\t\treturn event.user;\n\t}\n}\n"]}
|