xernerx 4.4.16 → 4.4.18
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/ContextCommandBuilder.d.ts +23 -31
- package/dist/build/ContextCommandBuilder.js +39 -39
- package/dist/build/EventBuilder.d.ts +2 -2
- package/dist/build/EventBuilder.d.ts.map +1 -1
- package/dist/build/EventBuilder.js +2 -2
- package/dist/build/EventBuilder.js.map +1 -1
- package/dist/build/InhibitorBuilder.d.ts +2 -11
- package/dist/build/InhibitorBuilder.js +2 -2
- package/dist/build/MessageCommandBuilder.d.ts +20 -26
- package/dist/build/MessageCommandBuilder.js +34 -34
- package/dist/build/SlashCommandBuilder.d.ts +25 -39
- package/dist/build/SlashCommandBuilder.js +48 -48
- package/dist/client/XernerxClient.d.ts +22 -30
- package/dist/client/XernerxClient.d.ts.map +1 -1
- package/dist/client/XernerxClient.js +35 -33
- package/dist/client/XernerxClient.js.map +1 -1
- package/dist/client/XernerxShardClient.d.ts +1 -1
- package/dist/client/XernerxShardClient.d.ts.map +1 -1
- package/dist/client/XernerxShardClient.js +17 -16
- package/dist/client/XernerxShardClient.js.map +1 -1
- package/dist/functions/delay.d.ts +1 -1
- package/dist/functions/delay.js +1 -1
- package/dist/functions/deploy.d.ts +2 -2
- package/dist/functions/deploy.d.ts.map +1 -1
- package/dist/functions/deploy.js +24 -18
- package/dist/functions/deploy.js.map +1 -1
- package/dist/functions/isOwner.d.ts +1 -1
- package/dist/functions/isOwner.js +1 -1
- package/dist/functions/isVoter.d.ts +1 -1
- package/dist/functions/isVoter.js +1 -1
- package/dist/functions/load.d.ts +1 -1
- package/dist/functions/load.js +3 -2
- package/dist/functions/reload.d.ts +1 -1
- package/dist/functions/reload.js +12 -9
- package/dist/functions/sendWebhook.d.ts +1 -1
- package/dist/functions/sendWebhook.js +3 -2
- package/dist/functions/setPresence.d.ts +2 -2
- package/dist/functions/setPresence.js +11 -12
- package/dist/functions/xernerxUser.d.ts +1 -1
- package/dist/functions/xernerxUser.js +1 -1
- package/dist/handlers/CommandHandler.d.ts +1 -1
- package/dist/handlers/CommandHandler.d.ts.map +1 -1
- package/dist/handlers/CommandHandler.js +109 -89
- package/dist/handlers/CommandHandler.js.map +1 -1
- package/dist/handlers/EventHandler.d.ts +1 -1
- package/dist/handlers/EventHandler.js +3 -3
- package/dist/handlers/ExtensionHandler.d.ts +1 -1
- package/dist/handlers/ExtensionHandler.js +5 -3
- package/dist/handlers/Handler.d.ts +1 -1
- package/dist/handlers/Handler.js +16 -6
- package/dist/handlers/InhibitorHandler.d.ts +1 -1
- package/dist/handlers/InhibitorHandler.js +3 -3
- package/dist/handlers/WebhookHandler.d.ts +4 -2
- package/dist/handlers/WebhookHandler.js +6 -9
- package/dist/main.d.ts +22 -29
- package/dist/main.js +22 -29
- package/dist/models/Arguments.d.ts +2 -5
- package/dist/models/Arguments.js +63 -48
- package/dist/tools/XernerxError.d.ts +1 -1
- package/dist/tools/XernerxError.js +1 -1
- package/dist/tools/XernerxLog.d.ts +1 -1
- package/dist/tools/XernerxLog.js +2 -7
- package/dist/types/extenders.d.ts +9 -5
- package/dist/types/extenders.js +1 -1
- package/dist/types/interfaces.d.ts +9 -12
- package/dist/types/interfaces.d.ts.map +1 -1
- package/dist/types/interfaces.js +1 -1
- package/dist/types/interfaces.js.map +1 -1
- package/dist/types/types.d.ts +7 -179
- package/dist/types/types.js +1 -1
- package/dist/utils/ClientUtil.d.ts +4 -4
- package/dist/utils/ClientUtil.js +14 -8
- package/dist/utils/InteractionUtil.d.ts +2 -2
- package/dist/utils/InteractionUtil.js +1 -1
- package/dist/utils/MessageUtil.d.ts +2 -2
- package/dist/utils/MessageUtil.js +9 -5
- package/dist/utils/Util.d.ts +1 -1
- package/dist/utils/Util.js +1 -1
- package/dist/validators/commandValidation.d.ts +2 -5
- package/dist/validators/commandValidation.js +29 -19
- package/dist/validators/inhibitorValidations.d.ts +3 -19
- package/dist/validators/inhibitorValidations.js +2 -2
- package/package.json +1 -1
package/dist/types/types.d.ts
CHANGED
|
@@ -1,186 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
SlashCommandBooleanOption,
|
|
3
|
-
SlashCommandChannelOption,
|
|
4
|
-
SlashCommandIntegerOption,
|
|
5
|
-
SlashCommandMentionableOption,
|
|
6
|
-
SlashCommandNumberOption,
|
|
7
|
-
SlashCommandRoleOption,
|
|
8
|
-
SlashCommandStringOption,
|
|
9
|
-
SlashCommandUserOption,
|
|
10
|
-
} from 'discord.js';
|
|
1
|
+
import { SlashCommandBooleanOption, SlashCommandChannelOption, SlashCommandIntegerOption, SlashCommandMentionableOption, SlashCommandNumberOption, SlashCommandRoleOption, SlashCommandStringOption, SlashCommandUserOption } from 'discord.js';
|
|
11
2
|
import { XernerxMessageContextInteraction, XernerxSlashInteraction, XernerxUserContextInteraction } from './extenders.js';
|
|
12
3
|
export type FileType = 'MessageCommand' | 'SlashCommand' | 'ContextCommand' | 'Event' | 'Inhibitor';
|
|
13
|
-
export type Locales =
|
|
14
|
-
| 'en-US'
|
|
15
|
-
| 'en-GB'
|
|
16
|
-
| 'bg'
|
|
17
|
-
| 'zh-CN'
|
|
18
|
-
| 'zh-TW'
|
|
19
|
-
| 'hr'
|
|
20
|
-
| 'cs'
|
|
21
|
-
| 'da'
|
|
22
|
-
| 'nl'
|
|
23
|
-
| 'fi'
|
|
24
|
-
| 'fr'
|
|
25
|
-
| 'de'
|
|
26
|
-
| 'el'
|
|
27
|
-
| 'hi'
|
|
28
|
-
| 'hu'
|
|
29
|
-
| 'it'
|
|
30
|
-
| 'ja'
|
|
31
|
-
| 'ko'
|
|
32
|
-
| 'lt'
|
|
33
|
-
| 'no'
|
|
34
|
-
| 'pl'
|
|
35
|
-
| 'pt-BR'
|
|
36
|
-
| 'ro'
|
|
37
|
-
| 'ru'
|
|
38
|
-
| 'es-ES'
|
|
39
|
-
| 'sv-SE'
|
|
40
|
-
| 'th'
|
|
41
|
-
| 'tr'
|
|
42
|
-
| 'uk'
|
|
43
|
-
| 'vi';
|
|
4
|
+
export type Locales = 'en-US' | 'en-GB' | 'bg' | 'zh-CN' | 'zh-TW' | 'hr' | 'cs' | 'da' | 'nl' | 'fi' | 'fr' | 'de' | 'el' | 'hi' | 'hu' | 'it' | 'ja' | 'ko' | 'lt' | 'no' | 'pl' | 'pt-BR' | 'ro' | 'ru' | 'es-ES' | 'sv-SE' | 'th' | 'tr' | 'uk' | 'vi';
|
|
44
5
|
export type SlashCommandArgumentType = 'attachment' | 'boolean' | 'channel' | 'integer' | 'mentionable' | 'number' | 'role' | 'string' | 'user';
|
|
45
6
|
export type SlashCommandOptionChoices = SlashCommandStringOption | SlashCommandNumberOption | SlashCommandIntegerOption;
|
|
46
7
|
export type SlashCommandOption = SlashCommandOptionChoices | SlashCommandBooleanOption | SlashCommandUserOption | SlashCommandChannelOption | SlashCommandRoleOption | SlashCommandMentionableOption;
|
|
47
|
-
export type MessageCommandArgumentType =
|
|
48
|
-
|
|
49
|
-
| 'number'
|
|
50
|
-
| 'boolean'
|
|
51
|
-
| 'confirm'
|
|
52
|
-
| 'channel'
|
|
53
|
-
| 'guild'
|
|
54
|
-
| 'integer'
|
|
55
|
-
| 'mentionable'
|
|
56
|
-
| 'role'
|
|
57
|
-
| 'user'
|
|
58
|
-
| 'message'
|
|
59
|
-
| 'member'
|
|
60
|
-
| 'list'
|
|
61
|
-
| 'option'
|
|
62
|
-
| 'rest';
|
|
63
|
-
export type DiscordEventType =
|
|
64
|
-
| 'applicationCommandPermissionsUpdate'
|
|
65
|
-
| 'autoModerationActionExecution'
|
|
66
|
-
| 'autoModerationRuleCreate'
|
|
67
|
-
| 'autoModerationRuleDelete'
|
|
68
|
-
| 'autoModerationRuleUpdate'
|
|
69
|
-
| 'ready'
|
|
70
|
-
| 'guildCreate'
|
|
71
|
-
| 'guildDelete'
|
|
72
|
-
| 'guildUpdate'
|
|
73
|
-
| 'guildUnavailable'
|
|
74
|
-
| 'guildMemberAdd'
|
|
75
|
-
| 'guildMemberRemove'
|
|
76
|
-
| 'guildMemberUpdate'
|
|
77
|
-
| 'guildMemberAvailable'
|
|
78
|
-
| 'guildMembersChunk'
|
|
79
|
-
| 'guildIntegrationsUpdate'
|
|
80
|
-
| 'roleCreate'
|
|
81
|
-
| 'roleDelete'
|
|
82
|
-
| 'inviteCreate'
|
|
83
|
-
| 'inviteDelete'
|
|
84
|
-
| 'roleUpdate'
|
|
85
|
-
| 'emojiCreate'
|
|
86
|
-
| 'emojiDelete'
|
|
87
|
-
| 'emojiUpdate'
|
|
88
|
-
| 'guildBanAdd'
|
|
89
|
-
| 'guildBanRemove'
|
|
90
|
-
| 'channelCreate'
|
|
91
|
-
| 'channelDelete'
|
|
92
|
-
| 'channelUpdate'
|
|
93
|
-
| 'channelPinsUpdate'
|
|
94
|
-
| 'messageCreate'
|
|
95
|
-
| 'messageDelete'
|
|
96
|
-
| 'messageUpdate'
|
|
97
|
-
| 'messageDeleteBulk'
|
|
98
|
-
| 'messageReactionAdd'
|
|
99
|
-
| 'messageReactionRemove'
|
|
100
|
-
| 'messageReactionRemoveAll'
|
|
101
|
-
| 'messageReactionRemoveEmoji'
|
|
102
|
-
| 'threadCreate'
|
|
103
|
-
| 'threadDelete'
|
|
104
|
-
| 'threadUpdate'
|
|
105
|
-
| 'threadListSync'
|
|
106
|
-
| 'threadMemberUpdate'
|
|
107
|
-
| 'threadMembersUpdate'
|
|
108
|
-
| 'userUpdate'
|
|
109
|
-
| 'presenceUpdate'
|
|
110
|
-
| 'voiceServerUpdate'
|
|
111
|
-
| 'voiceStateUpdate'
|
|
112
|
-
| 'typingStart'
|
|
113
|
-
| 'webhookUpdate'
|
|
114
|
-
| 'interactionCreate'
|
|
115
|
-
| 'error'
|
|
116
|
-
| 'warn'
|
|
117
|
-
| 'debug'
|
|
118
|
-
| 'cacheSweep'
|
|
119
|
-
| 'shardDisconnect'
|
|
120
|
-
| 'shardError'
|
|
121
|
-
| 'shardReconnecting'
|
|
122
|
-
| 'shardReady'
|
|
123
|
-
| 'shardResume'
|
|
124
|
-
| 'invalidated'
|
|
125
|
-
| 'raw'
|
|
126
|
-
| 'stageInstanceCreate'
|
|
127
|
-
| 'stageInstanceUpdate'
|
|
128
|
-
| 'stageInstanceDelete'
|
|
129
|
-
| 'stickerCreate'
|
|
130
|
-
| 'stickerDelete'
|
|
131
|
-
| 'stickerUpdate'
|
|
132
|
-
| 'guildScheduledEventCreate'
|
|
133
|
-
| 'guildScheduledEventUpdate'
|
|
134
|
-
| 'guildScheduledEventDelete'
|
|
135
|
-
| 'guildScheduledEventUserAdd'
|
|
136
|
-
| 'guildScheduledEventUserRemove';
|
|
8
|
+
export type MessageCommandArgumentType = 'string' | 'number' | 'boolean' | 'confirm' | 'channel' | 'guild' | 'integer' | 'mentionable' | 'role' | 'user' | 'message' | 'member' | 'list' | 'option' | 'rest';
|
|
9
|
+
export type DiscordEventType = 'applicationCommandPermissionsUpdate' | 'autoModerationActionExecution' | 'autoModerationRuleCreate' | 'autoModerationRuleDelete' | 'autoModerationRuleUpdate' | 'ready' | 'guildCreate' | 'guildDelete' | 'guildUpdate' | 'guildUnavailable' | 'guildMemberAdd' | 'guildMemberRemove' | 'guildMemberUpdate' | 'guildMemberAvailable' | 'guildMembersChunk' | 'guildIntegrationsUpdate' | 'roleCreate' | 'roleDelete' | 'inviteCreate' | 'inviteDelete' | 'roleUpdate' | 'emojiCreate' | 'emojiDelete' | 'emojiUpdate' | 'guildBanAdd' | 'guildBanRemove' | 'channelCreate' | 'channelDelete' | 'channelUpdate' | 'channelPinsUpdate' | 'messageCreate' | 'messageDelete' | 'messageUpdate' | 'messageDeleteBulk' | 'messageReactionAdd' | 'messageReactionRemove' | 'messageReactionRemoveAll' | 'messageReactionRemoveEmoji' | 'threadCreate' | 'threadDelete' | 'threadUpdate' | 'threadListSync' | 'threadMemberUpdate' | 'threadMembersUpdate' | 'userUpdate' | 'presenceUpdate' | 'voiceServerUpdate' | 'voiceStateUpdate' | 'typingStart' | 'webhookUpdate' | 'interactionCreate' | 'error' | 'warn' | 'debug' | 'cacheSweep' | 'shardDisconnect' | 'shardError' | 'shardReconnecting' | 'shardReady' | 'shardResume' | 'invalidated' | 'raw' | 'stageInstanceCreate' | 'stageInstanceUpdate' | 'stageInstanceDelete' | 'stickerCreate' | 'stickerDelete' | 'stickerUpdate' | 'guildScheduledEventCreate' | 'guildScheduledEventUpdate' | 'guildScheduledEventDelete' | 'guildScheduledEventUserAdd' | 'guildScheduledEventUserRemove';
|
|
137
10
|
export type EventType = DiscordEventType | 'webhookCreate' | 'webhookError' | 'commandBlock' | 'commandError' | 'commandStart' | 'commandFinish' | 'commandCooldown';
|
|
138
|
-
export type XernerxInteraction<T extends XernerxSlashInteraction | XernerxUserContextInteraction | XernerxMessageContextInteraction> = T extends XernerxSlashInteraction
|
|
139
|
-
|
|
140
|
-
: T extends XernerxUserContextInteraction
|
|
141
|
-
? XernerxUserContextInteraction
|
|
142
|
-
: XernerxMessageContextInteraction;
|
|
143
|
-
export type PermissionNames =
|
|
144
|
-
| 'create instant invite'
|
|
145
|
-
| 'kick members'
|
|
146
|
-
| 'ban members'
|
|
147
|
-
| 'administrator'
|
|
148
|
-
| 'manage channels'
|
|
149
|
-
| 'manage guild'
|
|
150
|
-
| 'add reactions'
|
|
151
|
-
| 'view audit log'
|
|
152
|
-
| 'priority speaker'
|
|
153
|
-
| 'stream'
|
|
154
|
-
| 'view channel'
|
|
155
|
-
| 'send messages'
|
|
156
|
-
| 'send tts messages'
|
|
157
|
-
| 'manage messages'
|
|
158
|
-
| 'embed links'
|
|
159
|
-
| 'attach files'
|
|
160
|
-
| 'read message history'
|
|
161
|
-
| 'mention everyone'
|
|
162
|
-
| 'use external emojis'
|
|
163
|
-
| 'view guild insights'
|
|
164
|
-
| 'connect'
|
|
165
|
-
| 'speak'
|
|
166
|
-
| 'mute members'
|
|
167
|
-
| 'deafen members'
|
|
168
|
-
| 'move members'
|
|
169
|
-
| 'use vad'
|
|
170
|
-
| 'change nickname'
|
|
171
|
-
| 'manage nicknames'
|
|
172
|
-
| 'manage roles'
|
|
173
|
-
| 'manage webhooks'
|
|
174
|
-
| 'manage emojis and stickers'
|
|
175
|
-
| 'use application commands'
|
|
176
|
-
| 'request to speak'
|
|
177
|
-
| 'manage events'
|
|
178
|
-
| 'manage threads'
|
|
179
|
-
| 'create public threads'
|
|
180
|
-
| 'create private threads'
|
|
181
|
-
| 'use external stickers'
|
|
182
|
-
| 'send messages in threads'
|
|
183
|
-
| 'start embedded activities'
|
|
184
|
-
| 'moderate members';
|
|
11
|
+
export type XernerxInteraction<T extends XernerxSlashInteraction | XernerxUserContextInteraction | XernerxMessageContextInteraction> = T extends XernerxSlashInteraction ? XernerxSlashInteraction : T extends XernerxUserContextInteraction ? XernerxUserContextInteraction : XernerxMessageContextInteraction;
|
|
12
|
+
export type PermissionNames = 'create instant invite' | 'kick members' | 'ban members' | 'administrator' | 'manage channels' | 'manage guild' | 'add reactions' | 'view audit log' | 'priority speaker' | 'stream' | 'view channel' | 'send messages' | 'send tts messages' | 'manage messages' | 'embed links' | 'attach files' | 'read message history' | 'mention everyone' | 'use external emojis' | 'view guild insights' | 'connect' | 'speak' | 'mute members' | 'deafen members' | 'move members' | 'use vad' | 'change nickname' | 'manage nicknames' | 'manage roles' | 'manage webhooks' | 'manage emojis and stickers' | 'use application commands' | 'request to speak' | 'manage events' | 'manage threads' | 'create public threads' | 'create private threads' | 'use external stickers' | 'send messages in threads' | 'start embedded activities' | 'moderate members';
|
|
185
13
|
export type InhibitorType = 'message' | 'interaction' | 'command' | 'channel' | 'user' | 'member' | 'guild' | 'contextCommand' | 'messageCommand' | 'slashCommand';
|
|
186
|
-
//# sourceMappingURL=types.d.ts.map
|
|
14
|
+
//# sourceMappingURL=types.d.ts.map
|
package/dist/types/types.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export {};
|
|
2
|
-
//# sourceMappingURL=types.js.map
|
|
2
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -4,8 +4,8 @@ import Util from './Util.js';
|
|
|
4
4
|
export default class ClientUtil extends Util {
|
|
5
5
|
hasVoted?: Function;
|
|
6
6
|
constructor(client: XernerxClient);
|
|
7
|
-
setPresence(options: PresenceOptions): import(
|
|
8
|
-
resolveChannel(query: string | Record<string, string>): Promise<import(
|
|
9
|
-
resolveGuild(query: string | Record<string, string>): Promise<import(
|
|
7
|
+
setPresence(options: PresenceOptions): import("discord.js").ClientPresence | undefined;
|
|
8
|
+
resolveChannel(query: string | Record<string, string>): Promise<import("discord.js").Channel | null>;
|
|
9
|
+
resolveGuild(query: string | Record<string, string>): Promise<import("discord.js").Guild | null>;
|
|
10
10
|
}
|
|
11
|
-
//# sourceMappingURL=ClientUtil.d.ts.map
|
|
11
|
+
//# sourceMappingURL=ClientUtil.d.ts.map
|
package/dist/utils/ClientUtil.js
CHANGED
|
@@ -8,24 +8,30 @@ export default class ClientUtil extends Util {
|
|
|
8
8
|
return setPresence(this.client, options);
|
|
9
9
|
}
|
|
10
10
|
async resolveChannel(query) {
|
|
11
|
-
if (typeof query == 'object')
|
|
11
|
+
if (typeof query == 'object')
|
|
12
|
+
query = query.id;
|
|
12
13
|
try {
|
|
13
|
-
let channel = this.client.channels.cache.find((channel) =>
|
|
14
|
-
if (!channel)
|
|
14
|
+
let channel = this.client.channels.cache.find((channel) => channel.name == query.toLowerCase() || channel.id == query.toLowerCase() ? channel : null) || null;
|
|
15
|
+
if (!channel)
|
|
16
|
+
channel = (await this.client.channels.fetch(query)) || null;
|
|
15
17
|
return channel;
|
|
16
|
-
}
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
17
20
|
return null;
|
|
18
21
|
}
|
|
19
22
|
}
|
|
20
23
|
async resolveGuild(query) {
|
|
21
|
-
if (typeof query == 'object')
|
|
24
|
+
if (typeof query == 'object')
|
|
25
|
+
query = query.id;
|
|
22
26
|
try {
|
|
23
27
|
let guild = this.client.guilds.cache.find((guild) => guild.name.toLowerCase() == query.toLowerCase()) || null;
|
|
24
|
-
if (!guild)
|
|
28
|
+
if (!guild)
|
|
29
|
+
guild = (await this.client.guilds.fetch(query)) || null;
|
|
25
30
|
return guild;
|
|
26
|
-
}
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
27
33
|
return null;
|
|
28
34
|
}
|
|
29
35
|
}
|
|
30
36
|
}
|
|
31
|
-
//# sourceMappingURL=ClientUtil.js.map
|
|
37
|
+
//# sourceMappingURL=ClientUtil.js.map
|
|
@@ -6,7 +6,7 @@ import { XernerxMessageContextInteraction, XernerxSlashInteraction, XernerxUserC
|
|
|
6
6
|
export default class InteractionUtil extends Util {
|
|
7
7
|
private interaction;
|
|
8
8
|
constructor(client: XernerxClient, interaction: XernerxInteraction<XernerxSlashInteraction | XernerxUserContextInteraction | XernerxMessageContextInteraction>);
|
|
9
|
-
reply(content: string | MessagePayload | InteractionReplyOptions | InteractionEditReplyOptions): Promise<import(
|
|
9
|
+
reply(content: string | MessagePayload | InteractionReplyOptions | InteractionEditReplyOptions): Promise<import("discord.js").Message<boolean> | import("discord.js").InteractionResponse<boolean>>;
|
|
10
10
|
delay(time: number): Promise<unknown>;
|
|
11
11
|
}
|
|
12
|
-
//# sourceMappingURL=InteractionUtil.d.ts.map
|
|
12
|
+
//# sourceMappingURL=InteractionUtil.d.ts.map
|
|
@@ -9,8 +9,8 @@ export default class MessageUtil extends Util {
|
|
|
9
9
|
prefix: null | string;
|
|
10
10
|
};
|
|
11
11
|
constructor(client: XernerxClient, message: XernerxMessage);
|
|
12
|
-
reply(content: string | MessagePayload | MessageReplyOptions | MessageEditOptions): Promise<import(
|
|
12
|
+
reply(content: string | MessagePayload | MessageReplyOptions | MessageEditOptions): Promise<import("discord.js").Message<boolean> | null>;
|
|
13
13
|
webhookReply(content: MessagePayload, url?: URL, user?: User): Promise<void>;
|
|
14
14
|
delay(time: number): Promise<unknown>;
|
|
15
15
|
}
|
|
16
|
-
//# sourceMappingURL=MessageUtil.d.ts.map
|
|
16
|
+
//# sourceMappingURL=MessageUtil.d.ts.map
|
|
@@ -16,7 +16,8 @@ export default class MessageUtil extends Util {
|
|
|
16
16
|
async reply(content) {
|
|
17
17
|
if (this.client.cache.messages.has(this.message.id)) {
|
|
18
18
|
const id = this.client.cache.messages.get(this.message.id);
|
|
19
|
-
if (!id)
|
|
19
|
+
if (!id)
|
|
20
|
+
return null;
|
|
20
21
|
const msg = await this.message.channel.messages.fetch(id);
|
|
21
22
|
msg.edit(content);
|
|
22
23
|
return msg;
|
|
@@ -26,7 +27,8 @@ export default class MessageUtil extends Util {
|
|
|
26
27
|
return msg;
|
|
27
28
|
}
|
|
28
29
|
async webhookReply(content, url, user) {
|
|
29
|
-
if (this.message.channel.type === ChannelType.DM)
|
|
30
|
+
if (this.message.channel.type === ChannelType.DM)
|
|
31
|
+
throw new XernerxError(`Can't use this method in DM Channels`);
|
|
30
32
|
const channel = this.message.channel;
|
|
31
33
|
let webhook;
|
|
32
34
|
if (!url) {
|
|
@@ -35,13 +37,15 @@ export default class MessageUtil extends Util {
|
|
|
35
37
|
avatar: user?.avatarURL() || this.client.user?.avatarURL(),
|
|
36
38
|
});
|
|
37
39
|
}
|
|
38
|
-
if (!webhook)
|
|
40
|
+
if (!webhook)
|
|
41
|
+
webhook = { url };
|
|
39
42
|
await sendWebhook(webhook.url, content);
|
|
40
|
-
if (!url)
|
|
43
|
+
if (!url)
|
|
44
|
+
webhook.delete();
|
|
41
45
|
return;
|
|
42
46
|
}
|
|
43
47
|
async delay(time) {
|
|
44
48
|
return await delay(time);
|
|
45
49
|
}
|
|
46
50
|
}
|
|
47
|
-
//# sourceMappingURL=MessageUtil.js.map
|
|
51
|
+
//# sourceMappingURL=MessageUtil.js.map
|
package/dist/utils/Util.d.ts
CHANGED
package/dist/utils/Util.js
CHANGED
|
@@ -3,8 +3,5 @@ import MessageCommandBuilder from '../build/MessageCommandBuilder.js';
|
|
|
3
3
|
import SlashCommandBuilder from '../build/SlashCommandBuilder.js';
|
|
4
4
|
import { XernerxMessage, XernerxSlashInteraction, XernerxUserContextInteraction } from '../types/extenders.js';
|
|
5
5
|
import { XernerxInteraction } from '../types/types.js';
|
|
6
|
-
export default function commandValidation(
|
|
7
|
-
|
|
8
|
-
command: MessageCommandBuilder | SlashCommandBuilder | ContextCommandBuilder
|
|
9
|
-
): Promise<boolean>;
|
|
10
|
-
//# sourceMappingURL=commandValidation.d.ts.map
|
|
6
|
+
export default function commandValidation(event: XernerxInteraction<XernerxSlashInteraction | XernerxUserContextInteraction | XernerxUserContextInteraction> | XernerxMessage, command: MessageCommandBuilder | SlashCommandBuilder | ContextCommandBuilder): Promise<boolean>;
|
|
7
|
+
//# sourceMappingURL=commandValidation.d.ts.map
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { ChannelType, PermissionFlagsBits } from 'discord.js';
|
|
2
2
|
export default async function commandValidation(event, command) {
|
|
3
3
|
const client = event.client;
|
|
4
|
-
if (command.ignore?.owner && client.settings.ownerId.includes(event.user.id))
|
|
4
|
+
if (command.ignore?.owner && client.settings.ownerId.includes(event.user.id))
|
|
5
|
+
return false;
|
|
5
6
|
if (!client.cache.cooldowns.has(`${event.user.id}-${command.name}`)) {
|
|
6
7
|
client.cache.cooldowns.set(`${event.user.id}-${command.name}`, {
|
|
7
8
|
id: event.user.id,
|
|
@@ -11,21 +12,31 @@ export default async function commandValidation(event, command) {
|
|
|
11
12
|
setTimeout(() => {
|
|
12
13
|
client.cache.cooldowns.delete(`${event.user.id}-${command.name}`);
|
|
13
14
|
}, command.cooldown || 0);
|
|
14
|
-
}
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
15
17
|
const user = client.cache.cooldowns.get(`${event.user.id}-${command.name}`);
|
|
16
18
|
const time = (user?.createdTimestamp || 0) - Number(Date.now());
|
|
17
19
|
return emit(event, `Command on cooldown, ${time}`);
|
|
18
20
|
}
|
|
19
|
-
if ((command.ignore?.channels?.length || 0) > 0 && command.ignore?.channels?.includes(event.channel?.id))
|
|
20
|
-
|
|
21
|
-
if ((command.ignore?.
|
|
22
|
-
|
|
23
|
-
if ((command.
|
|
24
|
-
|
|
25
|
-
if (
|
|
26
|
-
|
|
21
|
+
if ((command.ignore?.channels?.length || 0) > 0 && command.ignore?.channels?.includes(event.channel?.id))
|
|
22
|
+
return true;
|
|
23
|
+
if ((command.ignore?.guilds?.length || 0) > 0 && command.ignore?.guilds?.includes(event.guild?.id))
|
|
24
|
+
return true;
|
|
25
|
+
if ((command.ignore?.users?.length || 0) > 0 && command.ignore?.users?.includes(event.user.id))
|
|
26
|
+
return true;
|
|
27
|
+
if (command.strict?.owner && !client.settings.ownerId.includes(event.user.id))
|
|
28
|
+
return await emit(event, 'Command is a developer command');
|
|
29
|
+
if ((command.strict?.channels?.length || 0) > 0 && !command.strict?.channels?.includes(event.channel?.id))
|
|
30
|
+
return await emit(event, 'Command cannot be ran in this channel');
|
|
31
|
+
if ((command.strict?.guilds?.length || 0) > 0 && !command.strict?.guilds?.includes(event.guild?.id))
|
|
32
|
+
return await emit(event, 'Command cannot be ran in this guild');
|
|
33
|
+
if ((command.strict?.users?.length || 0) > 0 && !command.strict?.users?.includes(event.user.id))
|
|
34
|
+
return await emit(event, 'Command cannot be ran by you');
|
|
35
|
+
if (command.permissions?.dm == false && event.channel?.type === ChannelType.DM)
|
|
36
|
+
return await emit(event, "Can't use in a DM Channel");
|
|
27
37
|
if (command.permissions?.user) {
|
|
28
|
-
if (!(event.member?.permissions).has(toBigInt(command.permissions.user)))
|
|
38
|
+
if (!(event.member?.permissions).has(toBigInt(command.permissions.user)))
|
|
39
|
+
return await emit(event, 'Missing User Permissions');
|
|
29
40
|
}
|
|
30
41
|
return false;
|
|
31
42
|
}
|
|
@@ -37,14 +48,13 @@ function toBigInt(permissions) {
|
|
|
37
48
|
let bigIntPermissions = 0n;
|
|
38
49
|
permissions.map((permission) => {
|
|
39
50
|
permission =
|
|
40
|
-
PermissionFlagsBits[
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
if (typeof permission === 'bigint') bigIntPermissions += permission;
|
|
51
|
+
PermissionFlagsBits[permission
|
|
52
|
+
.split(/ +/)
|
|
53
|
+
.map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())
|
|
54
|
+
.join('')];
|
|
55
|
+
if (typeof permission === 'bigint')
|
|
56
|
+
bigIntPermissions += permission;
|
|
47
57
|
});
|
|
48
58
|
return bigIntPermissions;
|
|
49
59
|
}
|
|
50
|
-
//# sourceMappingURL=commandValidation.js.map
|
|
60
|
+
//# sourceMappingURL=commandValidation.js.map
|
|
@@ -1,22 +1,6 @@
|
|
|
1
1
|
import { ContextCommandBuilder, MessageCommandBuilder, SlashCommandBuilder } from '../main.js';
|
|
2
2
|
import { XernerxMessage, XernerxMessageContextInteraction, XernerxSlashInteraction, XernerxUserContextInteraction } from '../types/extenders.js';
|
|
3
3
|
import { InhibitorType, XernerxInteraction } from '../types/types.js';
|
|
4
|
-
export declare function inhibitorValidation(
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
): Promise<boolean>;
|
|
8
|
-
export declare function inhibitorArguments(
|
|
9
|
-
event: XernerxMessage | XernerxInteraction<XernerxSlashInteraction | XernerxUserContextInteraction | XernerxMessageContextInteraction>,
|
|
10
|
-
cmd: ContextCommandBuilder | MessageCommandBuilder | SlashCommandBuilder | null,
|
|
11
|
-
type: InhibitorType
|
|
12
|
-
):
|
|
13
|
-
| import('../main.js').XernerxUser
|
|
14
|
-
| import('discord.js').Guild
|
|
15
|
-
| import('discord.js').GuildMember
|
|
16
|
-
| import('discord.js').TextBasedChannel
|
|
17
|
-
| SlashCommandBuilder
|
|
18
|
-
| ContextCommandBuilder
|
|
19
|
-
| MessageCommandBuilder
|
|
20
|
-
| import('../main.js').APIInteractionGuildMember
|
|
21
|
-
| null;
|
|
22
|
-
//# sourceMappingURL=inhibitorValidations.d.ts.map
|
|
4
|
+
export declare function inhibitorValidation(event: XernerxMessage | XernerxInteraction<XernerxSlashInteraction | XernerxUserContextInteraction | XernerxMessageContextInteraction>, cmd?: ContextCommandBuilder | MessageCommandBuilder | SlashCommandBuilder): Promise<boolean>;
|
|
5
|
+
export declare function inhibitorArguments(event: XernerxMessage | XernerxInteraction<XernerxSlashInteraction | XernerxUserContextInteraction | XernerxMessageContextInteraction>, cmd: ContextCommandBuilder | MessageCommandBuilder | SlashCommandBuilder | null, type: InhibitorType): import("../main.js").XernerxUser | import("discord.js").Guild | import("discord.js").GuildMember | import("discord.js").TextBasedChannel | SlashCommandBuilder | ContextCommandBuilder | MessageCommandBuilder | import("../main.js").APIInteractionGuildMember | null;
|
|
6
|
+
//# sourceMappingURL=inhibitorValidations.d.ts.map
|
|
@@ -2,7 +2,7 @@ export async function inhibitorValidation(event, cmd) {
|
|
|
2
2
|
const client = event.client;
|
|
3
3
|
const inhibits = [];
|
|
4
4
|
for (const [name, inhibitor] of client.inhibitors) {
|
|
5
|
-
if (Boolean(await inhibitor.check(event, await inhibitorArguments(event, cmd || null, inhibitor.type)))) {
|
|
5
|
+
if (Boolean(await inhibitor.check(event, (await inhibitorArguments(event, cmd || null, inhibitor.type))))) {
|
|
6
6
|
inhibits.push(name);
|
|
7
7
|
}
|
|
8
8
|
}
|
|
@@ -32,4 +32,4 @@ export function inhibitorArguments(event, cmd, type) {
|
|
|
32
32
|
return event.user;
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
//# sourceMappingURL=inhibitorValidations.js.map
|
|
35
|
+
//# sourceMappingURL=inhibitorValidations.js.map
|