xernerx 3.3.5 → 3.3.7
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/LICENSE +21 -21
- package/README.md +21 -21
- package/dist/build/ContextCommandBuilder.d.ts +4 -4
- package/dist/build/ContextCommandBuilder.js +4 -4
- package/dist/build/EventBuilder.d.ts +2 -2
- package/dist/build/EventBuilder.js +4 -4
- package/dist/build/InhibitorBuilder.d.ts +3 -3
- package/dist/build/InhibitorBuilder.js +2 -2
- package/dist/build/MessageCommandBuilder.js +1 -1
- package/dist/build/SlashCommandBuilder.d.ts +1 -1
- package/dist/build/SlashCommandBuilder.js +1 -1
- package/dist/main.js +1 -1
- package/dist/models/CommandValidations.d.ts +3 -3
- package/dist/models/CommandValidations.js +26 -28
- package/dist/models/Events.js +8 -6
- package/dist/tools/package.d.ts +38 -0
- package/dist/tools/package.js +41 -0
- package/dist/types/{Types.d.ts → types.d.ts} +0 -0
- package/dist/{interfaces/ClientInterfaces.js → types/types.js} +0 -0
- package/package.json +7 -6
- package/dist/build/ContextCommand.d.ts +0 -40
- package/dist/build/ContextCommand.js +0 -84
- package/dist/build/Event.d.ts +0 -17
- package/dist/build/Event.js +0 -35
- package/dist/build/ExtensionBuilder.d.ts +0 -7
- package/dist/build/ExtensionBuilder.js +0 -9
- package/dist/build/Inhibitor.d.ts +0 -18
- package/dist/build/Inhibitor.js +0 -28
- package/dist/build/MessageCommand.d.ts +0 -41
- package/dist/build/MessageCommand.js +0 -82
- package/dist/build/SlashCommand.d.ts +0 -36
- package/dist/build/SlashCommand.js +0 -125
- package/dist/build/XernerxExtension.d.ts +0 -7
- package/dist/build/XernerxExtension.js +0 -9
- package/dist/handlers/WebhookHandler.d.ts +0 -12
- package/dist/handlers/WebhookHandler.js +0 -36
- package/dist/interfaces/ClientInterfaces.d.ts +0 -65
- package/dist/interfaces/CommandInterfaces.d.ts +0 -94
- package/dist/interfaces/CommandInterfaces.js +0 -1
- package/dist/interfaces/HandlerInterfaces.d.ts +0 -62
- package/dist/interfaces/HandlerInterfaces.js +0 -1
- package/dist/models/Functions.d.ts +0 -1
- package/dist/models/Functions.js +0 -1
- package/dist/types/EventTypes.d.ts +0 -1
- package/dist/types/EventTypes.js +0 -1
- package/dist/types/InhibitorTypes.d.ts +0 -12
- package/dist/types/InhibitorTypes.js +0 -13
- package/dist/types/Types.js +0 -1
- package/dist/types/objects.d.ts +0 -18
- package/dist/types/objects.js +0 -1
- package/scripts/package.d.ts +0 -1
- package/scripts/package.js +0 -3
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2022 Dummi
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Dummi
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
# xernerx
|
|
2
|
-
|
|
3
|
-
Xernerx is a class based discord.js framework. \[BETA\]
|
|
4
|
-
|
|
5
|
-
## Includes
|
|
6
|
-
|
|
7
|
-
> - Slash command handler
|
|
8
|
-
> - Message command handler
|
|
9
|
-
> - Context command handler
|
|
10
|
-
> - Event handler (with custom Events)
|
|
11
|
-
> - Inhibitor handler
|
|
12
|
-
> - Custom utilities
|
|
13
|
-
> - Message command handles
|
|
14
|
-
> - Extension support
|
|
15
|
-
|
|
16
|
-
You can checkout the docs [here](https://
|
|
17
|
-
|
|
18
|
-
## Notes
|
|
19
|
-
|
|
20
|
-
- Only compatible with ESM
|
|
21
|
-
- TypeScript and JavaScript support
|
|
1
|
+
# xernerx
|
|
2
|
+
|
|
3
|
+
Xernerx is a class based discord.js framework. \[BETA\]
|
|
4
|
+
|
|
5
|
+
## Includes
|
|
6
|
+
|
|
7
|
+
> - Slash command handler
|
|
8
|
+
> - Message command handler
|
|
9
|
+
> - Context command handler
|
|
10
|
+
> - Event handler (with custom Events)
|
|
11
|
+
> - Inhibitor handler
|
|
12
|
+
> - Custom utilities
|
|
13
|
+
> - Message command handles
|
|
14
|
+
> - Extension support
|
|
15
|
+
|
|
16
|
+
You can checkout the docs [here](https://xernerx.github.io/xernerx/home.html)
|
|
17
|
+
|
|
18
|
+
## Notes
|
|
19
|
+
|
|
20
|
+
- Only compatible with ESM
|
|
21
|
+
- TypeScript and JavaScript support
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ChannelType, ContextMenuCommandBuilder, Interaction } from
|
|
2
|
-
import { XernerxClient } from
|
|
3
|
-
import { ContextCommandOptions } from
|
|
1
|
+
import { ChannelType, ContextMenuCommandBuilder, Interaction } from 'discord.js';
|
|
2
|
+
import { XernerxClient } from '../main.js';
|
|
3
|
+
import { ContextCommandOptions } from '../types/options.js';
|
|
4
4
|
/**
|
|
5
5
|
* @description The command builder for context commands.
|
|
6
6
|
* @param {String} id - The unique ID of the command.
|
|
@@ -13,7 +13,7 @@ export default class ContextCommandBuilder {
|
|
|
13
13
|
info?: string;
|
|
14
14
|
category?: string;
|
|
15
15
|
owner?: boolean;
|
|
16
|
-
channelType?: ChannelType;
|
|
16
|
+
channelType?: ChannelType | ChannelType[];
|
|
17
17
|
cooldown?: number;
|
|
18
18
|
ignoreOwner?: boolean;
|
|
19
19
|
channels?: string[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ContextMenuCommandBuilder
|
|
2
|
-
import { s } from
|
|
3
|
-
import { XernerxClient } from
|
|
1
|
+
import { ContextMenuCommandBuilder } from 'discord.js';
|
|
2
|
+
import { s } from '@sapphire/shapeshift';
|
|
3
|
+
import { XernerxClient } from '../main.js';
|
|
4
4
|
/**
|
|
5
5
|
* @description The command builder for context commands.
|
|
6
6
|
* @param {String} id - The unique ID of the command.
|
|
@@ -42,7 +42,7 @@ export default class ContextCommandBuilder {
|
|
|
42
42
|
info: s.string.optional,
|
|
43
43
|
category: s.string.optional,
|
|
44
44
|
owner: s.boolean.optional,
|
|
45
|
-
|
|
45
|
+
channelType: s.union(s.number, s.array(s.number)).optional,
|
|
46
46
|
cooldown: s.number.optional,
|
|
47
47
|
ignoreOwner: s.boolean.optional,
|
|
48
48
|
channels: s.array(s.string).optional,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { XernerxClient } from
|
|
2
|
-
import { EventOptions } from
|
|
1
|
+
import { XernerxClient } from '../main.js';
|
|
2
|
+
import { EventOptions } from '../types/options.js';
|
|
3
3
|
/**
|
|
4
4
|
* @description - The event builder for events.
|
|
5
5
|
* @param {String} id - The unique ID of the event.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { s } from
|
|
2
|
-
import { XernerxClient } from
|
|
1
|
+
import { s } from '@sapphire/shapeshift';
|
|
2
|
+
import { XernerxClient } from '../main.js';
|
|
3
3
|
/**
|
|
4
4
|
* @description - The event builder for events.
|
|
5
5
|
* @param {String} id - The unique ID of the event.
|
|
@@ -21,8 +21,8 @@ export default class EventBuilder {
|
|
|
21
21
|
once: s.boolean.optional,
|
|
22
22
|
}).parse(options);
|
|
23
23
|
this.name = options.name;
|
|
24
|
-
this.emitter = options.emitter ||
|
|
25
|
-
this.type = options.type ||
|
|
24
|
+
this.emitter = options.emitter || 'client';
|
|
25
|
+
this.type = options.type || 'discord';
|
|
26
26
|
this.once = options.once || false;
|
|
27
27
|
this.client = XernerxClient;
|
|
28
28
|
this.run = this.run;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { InhibitorType, XernerxClient } from
|
|
2
|
-
import { InhibitorOptions, MessageArgOptions, SlashArgOptions } from
|
|
3
|
-
import { XernerxInteraction, XernerxMessage } from
|
|
1
|
+
import { InhibitorType, XernerxClient } from '../main.js';
|
|
2
|
+
import { InhibitorOptions, MessageArgOptions, SlashArgOptions } from '../types/options.js';
|
|
3
|
+
import { XernerxInteraction, XernerxMessage } from '../types/types.js';
|
|
4
4
|
/**
|
|
5
5
|
* @description - The inhibitor builder for inhibitors.
|
|
6
6
|
* @param {String} id - The unique ID of the inhibitor.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { s } from
|
|
2
|
-
import { XernerxClient } from
|
|
1
|
+
import { s } from '@sapphire/shapeshift';
|
|
2
|
+
import { XernerxClient } from '../main.js';
|
|
3
3
|
/**
|
|
4
4
|
* @description - The inhibitor builder for inhibitors.
|
|
5
5
|
* @param {String} id - The unique ID of the inhibitor.
|
|
@@ -35,7 +35,7 @@ export default class MessageCommandBuilder {
|
|
|
35
35
|
category: s.string.optional,
|
|
36
36
|
prefix: s.union(s.array(s.string).unique, s.string).optional,
|
|
37
37
|
owner: s.boolean.optional,
|
|
38
|
-
|
|
38
|
+
channelType: s.union(s.number, s.array(s.number)).optional,
|
|
39
39
|
separator: s.string.optional,
|
|
40
40
|
cooldown: s.number.optional,
|
|
41
41
|
ignoreOwner: s.boolean.optional,
|
|
@@ -42,7 +42,7 @@ export default class SlashCommandBuilder {
|
|
|
42
42
|
info: s.string.optional,
|
|
43
43
|
category: s.string.optional,
|
|
44
44
|
owner: s.boolean.optional,
|
|
45
|
-
|
|
45
|
+
channelType: s.union(s.number, s.array(s.number)).optional,
|
|
46
46
|
separator: s.string.optional,
|
|
47
47
|
cooldown: s.number.optional,
|
|
48
48
|
ignoreOwner: s.boolean.optional,
|
package/dist/main.js
CHANGED
|
@@ -9,7 +9,7 @@ import SlashCommandBuilder from './build/SlashCommandBuilder.js';
|
|
|
9
9
|
import { CommandType, EventEmitterType, ContextCommandType, InhibitorType } from './types/enums.js';
|
|
10
10
|
import XernerxError from './tools/XernerxError.js';
|
|
11
11
|
import ExtensionBuilder from 'xernerx-extension-builder';
|
|
12
|
-
import pkg from '
|
|
12
|
+
import pkg from './tools/package.js';
|
|
13
13
|
const version = pkg.version;
|
|
14
14
|
export default {
|
|
15
15
|
// Imported methods
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Interaction } from
|
|
2
|
-
import { ContextCommandBuilder, MessageCommandBuilder, SlashCommandBuilder, XernerxClient } from
|
|
3
|
-
import { XernerxMessage } from
|
|
1
|
+
import { Interaction } from 'discord.js';
|
|
2
|
+
import { ContextCommandBuilder, MessageCommandBuilder, SlashCommandBuilder, XernerxClient } from '../main.js';
|
|
3
|
+
import { XernerxMessage } from '../types/types.js';
|
|
4
4
|
export default function commandValidation(action: XernerxMessage | Interaction, command: SlashCommandBuilder | MessageCommandBuilder | ContextCommandBuilder | any, client: XernerxClient, res?: boolean): boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Message } from
|
|
2
|
-
import { CommandType } from
|
|
1
|
+
import { Message } from 'discord.js';
|
|
2
|
+
import { CommandType } from '../types/enums.js';
|
|
3
3
|
function getUser(from) {
|
|
4
4
|
if (from instanceof Message)
|
|
5
5
|
return from.author;
|
|
@@ -14,26 +14,30 @@ export default function commandValidation(action, command, client, res = false)
|
|
|
14
14
|
return true;
|
|
15
15
|
else if (command.owner && !client.util.isOwner(user.id)) {
|
|
16
16
|
res = true;
|
|
17
|
-
emit(client, action, command,
|
|
17
|
+
emit(client, action, command, 'Not an owner', client.settings.ownerId);
|
|
18
18
|
}
|
|
19
19
|
else if (command.channelType?.length > 0 || command.channelType) {
|
|
20
20
|
if (!Array.isArray(command.channelType))
|
|
21
21
|
command.channelType = [command.channelType];
|
|
22
22
|
if (!command?.channelType?.includes(action.channel?.type)) {
|
|
23
23
|
res = true;
|
|
24
|
-
emit(client, action, command,
|
|
24
|
+
emit(client, action, command, 'Not the correct channel', command.channelType);
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
else if (command.channels?.length > 0 && !command.channels.includes(action.channel?.id)) {
|
|
28
28
|
res = true;
|
|
29
|
-
emit(client, action, command,
|
|
29
|
+
emit(client, action, command, 'Not a whitelisted channel', command.channels);
|
|
30
30
|
}
|
|
31
31
|
else if (command.guilds?.length > 0 && !command.guilds.includes(action.guild?.id)) {
|
|
32
32
|
res = true;
|
|
33
|
-
emit(client, action, command,
|
|
33
|
+
emit(client, action, command, 'Not a whitelisted guild', command.guilds);
|
|
34
|
+
}
|
|
35
|
+
else if (command.channelType && command.channelType !== action.channel?.type) {
|
|
36
|
+
res = true;
|
|
37
|
+
emit(client, action, command, 'Not the correct type of channel', command.channelType);
|
|
34
38
|
}
|
|
35
39
|
else if (action?.guild && (command.userPermissions || client.settings.userPermissions)) {
|
|
36
|
-
const permissions = command.userPermissions || client?.settings?.userPermissions?.push(...handlerPermissions(client, command.commandType,
|
|
40
|
+
const permissions = command.userPermissions || client?.settings?.userPermissions?.push(...handlerPermissions(client, command.commandType, 'user')), missing = [];
|
|
37
41
|
if (Array.isArray(permissions))
|
|
38
42
|
permissions.map((permission) => {
|
|
39
43
|
if (!(action.member?.permissions).has(permission)) {
|
|
@@ -42,11 +46,11 @@ export default function commandValidation(action, command, client, res = false)
|
|
|
42
46
|
});
|
|
43
47
|
if (missing.length > 0) {
|
|
44
48
|
res = true;
|
|
45
|
-
emit(client, action, command,
|
|
49
|
+
emit(client, action, command, 'Missing User Permissions', missing);
|
|
46
50
|
}
|
|
47
51
|
}
|
|
48
52
|
else if (action?.guild && (command.clientPermissions || client.settings.clientPermissions)) {
|
|
49
|
-
const permissions = command.clientPermissions || client?.settings?.clientPermissions?.push(...handlerPermissions(client, command.commandType,
|
|
53
|
+
const permissions = command.clientPermissions || client?.settings?.clientPermissions?.push(...handlerPermissions(client, command.commandType, 'client')), missing = [];
|
|
50
54
|
if (Array.isArray(permissions))
|
|
51
55
|
permissions.map((permission) => {
|
|
52
56
|
if (!(action.member?.permissions).has(permission)) {
|
|
@@ -55,17 +59,17 @@ export default function commandValidation(action, command, client, res = false)
|
|
|
55
59
|
});
|
|
56
60
|
if (missing.length > 0) {
|
|
57
61
|
res = true;
|
|
58
|
-
emit(client, action, command,
|
|
62
|
+
emit(client, action, command, 'Missing Client Permissions', missing);
|
|
59
63
|
}
|
|
60
64
|
}
|
|
61
65
|
return res;
|
|
62
66
|
}
|
|
63
67
|
function emit(client, action, command, reason, extra) {
|
|
64
|
-
return client.emit(
|
|
68
|
+
return client.emit('commandBlock', action, command, reason, extra);
|
|
65
69
|
}
|
|
66
70
|
function inCooldown(user, client, command, action) {
|
|
67
71
|
let res = false, downs = {};
|
|
68
|
-
const { cooldowns, messageCommands, slashCommands, contextCommands, commands
|
|
72
|
+
const { cooldowns, messageCommands, slashCommands, contextCommands, commands } = client.cache;
|
|
69
73
|
if (command.commandType === CommandType.MessageCommand && client.handlerOptions.message.cooldown) {
|
|
70
74
|
if (messageCommands.has(user.id)) {
|
|
71
75
|
const usr = messageCommands.get(user.id);
|
|
@@ -80,8 +84,7 @@ function inCooldown(user, client, command, action) {
|
|
|
80
84
|
}, client.handlerOptions.message.cooldown);
|
|
81
85
|
}
|
|
82
86
|
}
|
|
83
|
-
if (command.commandType === CommandType.SlashCommand &&
|
|
84
|
-
client.handlerOptions.slash.cooldown) {
|
|
87
|
+
if (command.commandType === CommandType.SlashCommand && client.handlerOptions.slash.cooldown) {
|
|
85
88
|
if (slashCommands.has(user.id)) {
|
|
86
89
|
const usr = slashCommands.get(user.id);
|
|
87
90
|
usr.timeRemaining = usr.endsAt - Date.now();
|
|
@@ -95,8 +98,7 @@ function inCooldown(user, client, command, action) {
|
|
|
95
98
|
}, client.handlerOptions.slash.cooldown);
|
|
96
99
|
}
|
|
97
100
|
}
|
|
98
|
-
if (command.commandType === CommandType.ContextCommand &&
|
|
99
|
-
client.handlerOptions.context.cooldown) {
|
|
101
|
+
if (command.commandType === CommandType.ContextCommand && client.handlerOptions.context.cooldown) {
|
|
100
102
|
if (contextCommands.has(user.id)) {
|
|
101
103
|
const usr = contextCommands.get(user.id);
|
|
102
104
|
usr.timeRemaining = usr.endsAt - Date.now();
|
|
@@ -125,11 +127,7 @@ function inCooldown(user, client, command, action) {
|
|
|
125
127
|
}
|
|
126
128
|
}
|
|
127
129
|
if (command.cooldown) {
|
|
128
|
-
const name = user.id +
|
|
129
|
-
"-" +
|
|
130
|
-
(command.data?.name || command?.name) +
|
|
131
|
-
"-" +
|
|
132
|
-
command.commandType;
|
|
130
|
+
const name = user.id + '-' + (command.data?.name || command?.name) + '-' + command.commandType;
|
|
133
131
|
if (commands.has(name)) {
|
|
134
132
|
const usr = commands.get(name);
|
|
135
133
|
usr.timeRemaining = usr.endsAt - Date.now();
|
|
@@ -144,7 +142,7 @@ function inCooldown(user, client, command, action) {
|
|
|
144
142
|
}
|
|
145
143
|
}
|
|
146
144
|
if (Object.keys(downs).length > 0)
|
|
147
|
-
client.emit(
|
|
145
|
+
client.emit('commandCooldown', action, command, downs);
|
|
148
146
|
return res;
|
|
149
147
|
}
|
|
150
148
|
function toCooldown(action, command, cooldown, name) {
|
|
@@ -164,21 +162,21 @@ function toCooldown(action, command, cooldown, name) {
|
|
|
164
162
|
function handlerPermissions(client, commandType, type) {
|
|
165
163
|
let permissions = [];
|
|
166
164
|
if (commandType === CommandType.MessageCommand) {
|
|
167
|
-
if (type ===
|
|
165
|
+
if (type === 'user')
|
|
168
166
|
permissions = client.handlerOptions.message?.userPermissions || [];
|
|
169
|
-
else if (type ===
|
|
167
|
+
else if (type === 'client')
|
|
170
168
|
permissions = client.handlerOptions.message?.clientPermissions || [];
|
|
171
169
|
}
|
|
172
170
|
else if (commandType === CommandType.SlashCommand) {
|
|
173
|
-
if (type ===
|
|
171
|
+
if (type === 'user')
|
|
174
172
|
permissions = client.handlerOptions.slash?.userPermissions || [];
|
|
175
|
-
else if (type ===
|
|
173
|
+
else if (type === 'client')
|
|
176
174
|
permissions = client.handlerOptions.slash?.clientPermissions || [];
|
|
177
175
|
}
|
|
178
176
|
else if (commandType === CommandType.ContextCommand) {
|
|
179
|
-
if (type ===
|
|
177
|
+
if (type === 'user')
|
|
180
178
|
permissions = client.handlerOptions.context?.userPermissions || [];
|
|
181
|
-
else if (type ===
|
|
179
|
+
else if (type === 'client')
|
|
182
180
|
permissions = client.handlerOptions.context?.clientPermissions || [];
|
|
183
181
|
}
|
|
184
182
|
return permissions;
|
package/dist/models/Events.js
CHANGED
|
@@ -129,14 +129,16 @@ export class MessageCommandEvents {
|
|
|
129
129
|
messageDelete() {
|
|
130
130
|
this.client.on('messageDelete', async (message) => {
|
|
131
131
|
if (this.client.cache.messages.has(message.id) && this.client.handlerOptions.message?.handleDeletes) {
|
|
132
|
-
if (this.client.handlerOptions.message?.handleTyping)
|
|
133
|
-
message.channel.sendTyping();
|
|
134
132
|
try {
|
|
133
|
+
if (this.client.handlerOptions.message?.handleTyping)
|
|
134
|
+
message.channel.sendTyping();
|
|
135
135
|
const msg = this.client.cache.messages.get(message.id);
|
|
136
136
|
const response = await message.channel.messages.fetch(msg?.response);
|
|
137
137
|
await response.delete();
|
|
138
138
|
}
|
|
139
|
-
catch {
|
|
139
|
+
catch (error) {
|
|
140
|
+
this.client.emit('commandError', message, error, null);
|
|
141
|
+
}
|
|
140
142
|
}
|
|
141
143
|
});
|
|
142
144
|
}
|
|
@@ -231,13 +233,13 @@ export class CommandsDeploy {
|
|
|
231
233
|
this.put('global', guild.slash, [...contextCommands, ...slashCommands]);
|
|
232
234
|
this.put('guild', guild.slash, []);
|
|
233
235
|
}
|
|
234
|
-
if (global.slash &&
|
|
236
|
+
if (global.slash && global.context === false) {
|
|
235
237
|
this.put('global', guild.slash, slashCommands);
|
|
236
238
|
}
|
|
237
|
-
if (
|
|
239
|
+
if (global.slash === false && global.context) {
|
|
238
240
|
this.put('global', guild.context, contextCommands);
|
|
239
241
|
}
|
|
240
|
-
if (
|
|
242
|
+
if (global.slash === false && global.context === false) {
|
|
241
243
|
this.put('guild', guild.slash, [...contextCommands, ...slashCommands]);
|
|
242
244
|
}
|
|
243
245
|
console.log(Style.log(`Xernerx | Deployed ${slashCommands.length} slash commands ${global.slash ? 'globally' : 'locally'} and ${contextCommands.length} context commands ${global.context ? 'globally' : 'locally'}.`, { color: Style.TextColor.Purple }));
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
name: string;
|
|
3
|
+
version: string;
|
|
4
|
+
type: string;
|
|
5
|
+
description: string;
|
|
6
|
+
main: string;
|
|
7
|
+
keywords: string[];
|
|
8
|
+
author: string;
|
|
9
|
+
license: string;
|
|
10
|
+
homepage: string;
|
|
11
|
+
packageManager: string;
|
|
12
|
+
scripts: {
|
|
13
|
+
start: string;
|
|
14
|
+
patch: string;
|
|
15
|
+
minor: string;
|
|
16
|
+
major: string;
|
|
17
|
+
site: string;
|
|
18
|
+
commit: string;
|
|
19
|
+
package: string;
|
|
20
|
+
};
|
|
21
|
+
repository: {
|
|
22
|
+
type: string;
|
|
23
|
+
url: string;
|
|
24
|
+
};
|
|
25
|
+
bugs: {
|
|
26
|
+
url: string;
|
|
27
|
+
};
|
|
28
|
+
dependencies: {
|
|
29
|
+
"@sapphire/shapeshift": string;
|
|
30
|
+
"discord.js": string;
|
|
31
|
+
dumfunctions: string;
|
|
32
|
+
"xernerx-extension-builder": string;
|
|
33
|
+
};
|
|
34
|
+
devDependencies: {
|
|
35
|
+
typescript: string;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
export default _default;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
"name": "xernerx",
|
|
3
|
+
"version": "3.3.6",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "A bot framework for discord.js.",
|
|
6
|
+
"main": "dist/main.js",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"discord.js",
|
|
9
|
+
"discord",
|
|
10
|
+
"framework"
|
|
11
|
+
],
|
|
12
|
+
"author": "Dummi",
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"homepage": "https://xernerx.github.io/xernerx/home.html",
|
|
15
|
+
"packageManager": "npm@8.5.5",
|
|
16
|
+
"scripts": {
|
|
17
|
+
"start": "npm i && npm fund && npm audit fix --force && npm link && npm run package && tsc -w",
|
|
18
|
+
"patch": "git add . && npm run commit && npm version patch && npm publish && git push",
|
|
19
|
+
"minor": "git add . && npm run commit && npm version minor && npm publish && git push",
|
|
20
|
+
"major": "git add . && npm run commit && npm version major && npm publish && git push",
|
|
21
|
+
"site": "git add docs && npm run commit && git push",
|
|
22
|
+
"commit": "node ../scripts/commit.js",
|
|
23
|
+
"package": "node ../scripts/rewritePackage.js"
|
|
24
|
+
},
|
|
25
|
+
"repository": {
|
|
26
|
+
"type": "git",
|
|
27
|
+
"url": "git+https://github.com/xernerx/xernerx.git"
|
|
28
|
+
},
|
|
29
|
+
"bugs": {
|
|
30
|
+
"url": "https://github.com/xernerx/xernerx/issues"
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@sapphire/shapeshift": "^3.8.1",
|
|
34
|
+
"discord.js": "^14.7.0",
|
|
35
|
+
"dumfunctions": "^2.0.0",
|
|
36
|
+
"xernerx-extension-builder": "^0.0.2"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"typescript": "^4.9.4"
|
|
40
|
+
}
|
|
41
|
+
};
|
|
File without changes
|
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xernerx",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A bot framework for discord.js.",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -11,22 +11,23 @@
|
|
|
11
11
|
],
|
|
12
12
|
"author": "Dummi",
|
|
13
13
|
"license": "MIT",
|
|
14
|
-
"homepage": "https://
|
|
14
|
+
"homepage": "https://xernerx.github.io/xernerx/home.html",
|
|
15
15
|
"packageManager": "npm@8.5.5",
|
|
16
16
|
"scripts": {
|
|
17
|
-
"
|
|
17
|
+
"start": "npm i && npm fund && npm audit fix --force && npm link && npm run package && tsc -w",
|
|
18
18
|
"patch": "git add . && npm run commit && npm version patch && npm publish && git push",
|
|
19
19
|
"minor": "git add . && npm run commit && npm version minor && npm publish && git push",
|
|
20
20
|
"major": "git add . && npm run commit && npm version major && npm publish && git push",
|
|
21
21
|
"site": "git add docs && npm run commit && git push",
|
|
22
|
-
"commit": "node scripts/commit.js"
|
|
22
|
+
"commit": "node ../.scripts/commit.js",
|
|
23
|
+
"package": "node ../.scripts/rewritePackage.js"
|
|
23
24
|
},
|
|
24
25
|
"repository": {
|
|
25
26
|
"type": "git",
|
|
26
|
-
"url": "git+https://github.com/
|
|
27
|
+
"url": "git+https://github.com/xernerx/xernerx.git"
|
|
27
28
|
},
|
|
28
29
|
"bugs": {
|
|
29
|
-
"url": "https://github.com/
|
|
30
|
+
"url": "https://github.com/xernerx/xernerx/issues"
|
|
30
31
|
},
|
|
31
32
|
"dependencies": {
|
|
32
33
|
"@sapphire/shapeshift": "^3.8.1",
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { ChannelType, ContextMenuCommandBuilder, Interaction } from "discord.js";
|
|
2
|
-
import { ContextCommandOptions } from "../interfaces/CommandInterfaces.js";
|
|
3
|
-
import { XernerxClient } from "../main.js";
|
|
4
|
-
/**
|
|
5
|
-
* @description The command builder for context commands.
|
|
6
|
-
* @param {String} id - The unique ID of the command.
|
|
7
|
-
* @param {ContextCommandOptions} options - The command options.
|
|
8
|
-
*/
|
|
9
|
-
export default class ContextCommandBuilder {
|
|
10
|
-
id: string;
|
|
11
|
-
data: ContextMenuCommandBuilder;
|
|
12
|
-
description?: string;
|
|
13
|
-
info?: string;
|
|
14
|
-
category?: string;
|
|
15
|
-
owner?: boolean;
|
|
16
|
-
channelType?: ChannelType;
|
|
17
|
-
cooldown?: number;
|
|
18
|
-
ignoreOwner?: boolean;
|
|
19
|
-
channels?: string[];
|
|
20
|
-
guilds?: string[];
|
|
21
|
-
userPermissions?: bigint[];
|
|
22
|
-
clientPermissions?: bigint[];
|
|
23
|
-
defer?: {
|
|
24
|
-
reply?: boolean;
|
|
25
|
-
ephemeral?: boolean;
|
|
26
|
-
fetchReply?: boolean;
|
|
27
|
-
};
|
|
28
|
-
client: XernerxClient | object;
|
|
29
|
-
constructor(id: string, options: ContextCommandOptions);
|
|
30
|
-
/**
|
|
31
|
-
* @param {Interaction} interaction - The Discord interaction event data.
|
|
32
|
-
* @description make any preconditions here.
|
|
33
|
-
*/
|
|
34
|
-
conditions(interaction: Interaction): Promise<void>;
|
|
35
|
-
/**
|
|
36
|
-
* @param {Interaction} interaction - The Discord interaction event data.
|
|
37
|
-
* @description Make your custom command here.
|
|
38
|
-
*/
|
|
39
|
-
exec(interaction: Interaction): Promise<void>;
|
|
40
|
-
}
|