xernerx 4.4.4 → 4.4.6
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 +26 -33
- package/dist/build/ContextCommandBuilder.js +38 -38
- package/dist/build/EventBuilder.d.ts +3 -1
- package/dist/build/EventBuilder.js +1 -1
- package/dist/build/InhibitorBuilder.d.ts +5 -3
- package/dist/build/InhibitorBuilder.js +1 -1
- package/dist/build/MessageCommandBuilder.d.ts +24 -28
- package/dist/build/MessageCommandBuilder.js +33 -33
- package/dist/build/SlashCommandBuilder.d.ts +29 -34
- package/dist/build/SlashCommandBuilder.js +47 -47
- package/dist/client/XernerxClient.d.ts +21 -29
- package/dist/client/XernerxClient.js +32 -32
- package/dist/client/XernerxShardClient.js +3 -5
- package/dist/functions/deploy.js +15 -12
- package/dist/functions/load.js +2 -1
- package/dist/functions/reload.js +11 -8
- package/dist/functions/sendWebhook.js +2 -1
- package/dist/functions/setPresence.d.ts +1 -1
- package/dist/functions/setPresence.js +10 -11
- package/dist/handlers/CommandHandler.js +104 -81
- package/dist/handlers/EventHandler.js +2 -2
- package/dist/handlers/ExtensionHandler.js +4 -2
- package/dist/handlers/Handler.js +15 -5
- package/dist/handlers/InhibitorHandler.js +2 -2
- package/dist/handlers/WebhookHandler.d.ts +3 -1
- package/dist/handlers/WebhookHandler.js +5 -8
- package/dist/main.d.ts +21 -28
- package/dist/main.js +21 -28
- package/dist/models/Arguments.d.ts +1 -8
- package/dist/models/Arguments.js +72 -51
- package/dist/tools/XernerxLog.js +1 -6
- package/dist/types/extenders.d.ts +8 -4
- package/dist/types/interfaces.d.ts +6 -12
- package/dist/types/types.d.ts +5 -173
- package/dist/utils/ClientUtil.d.ts +3 -3
- package/dist/utils/ClientUtil.js +13 -7
- package/dist/utils/InteractionUtil.d.ts +1 -1
- package/dist/utils/MessageUtil.d.ts +1 -1
- package/dist/utils/MessageUtil.js +8 -4
- package/dist/validators/commandValidation.js +28 -18
- package/dist/validators/inhibitorValidations.d.ts +1 -14
- package/package.json +1 -1
package/dist/main.d.ts
CHANGED
|
@@ -12,31 +12,24 @@ import ExtensionBuilder from 'xernerx-extension-builder';
|
|
|
12
12
|
import Discord from 'discord.js';
|
|
13
13
|
declare const version: any;
|
|
14
14
|
export default XernerxClient;
|
|
15
|
-
export {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
*/
|
|
37
|
-
version,
|
|
38
|
-
/**
|
|
39
|
-
** Tools
|
|
40
|
-
*/
|
|
41
|
-
XernerxLog,
|
|
42
|
-
};
|
|
15
|
+
export {
|
|
16
|
+
/**
|
|
17
|
+
** Clients
|
|
18
|
+
*/
|
|
19
|
+
XernerxClient, XernerxShardClient,
|
|
20
|
+
/**
|
|
21
|
+
** Builders
|
|
22
|
+
*/
|
|
23
|
+
MessageCommandBuilder, SlashCommandBuilder, ContextCommandBuilder, EventBuilder, InhibitorBuilder, ExtensionBuilder,
|
|
24
|
+
/**
|
|
25
|
+
** Imported exports
|
|
26
|
+
*/
|
|
27
|
+
Discord,
|
|
28
|
+
/**
|
|
29
|
+
** Properties
|
|
30
|
+
*/
|
|
31
|
+
version,
|
|
32
|
+
/**
|
|
33
|
+
** Tools
|
|
34
|
+
*/
|
|
35
|
+
XernerxLog, };
|
package/dist/main.js
CHANGED
|
@@ -13,31 +13,24 @@ import ExtensionBuilder from 'xernerx-extension-builder';
|
|
|
13
13
|
import Discord from 'discord.js';
|
|
14
14
|
const version = JSON.parse(fs.readFileSync('node_modules/xernerx/package.json', 'utf-8')).version;
|
|
15
15
|
export default XernerxClient;
|
|
16
|
-
export {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
*/
|
|
38
|
-
version,
|
|
39
|
-
/**
|
|
40
|
-
** Tools
|
|
41
|
-
*/
|
|
42
|
-
XernerxLog,
|
|
43
|
-
};
|
|
16
|
+
export {
|
|
17
|
+
/**
|
|
18
|
+
** Clients
|
|
19
|
+
*/
|
|
20
|
+
XernerxClient, XernerxShardClient,
|
|
21
|
+
/**
|
|
22
|
+
** Builders
|
|
23
|
+
*/
|
|
24
|
+
MessageCommandBuilder, SlashCommandBuilder, ContextCommandBuilder, EventBuilder, InhibitorBuilder, ExtensionBuilder,
|
|
25
|
+
/**
|
|
26
|
+
** Imported exports
|
|
27
|
+
*/
|
|
28
|
+
Discord,
|
|
29
|
+
/**
|
|
30
|
+
** Properties
|
|
31
|
+
*/
|
|
32
|
+
version,
|
|
33
|
+
/**
|
|
34
|
+
** Tools
|
|
35
|
+
*/
|
|
36
|
+
XernerxLog, };
|
|
@@ -5,11 +5,4 @@ import { XernerxMessage } from '../types/extenders.js';
|
|
|
5
5
|
import { MessageCommandArguments } from '../types/interfaces.js';
|
|
6
6
|
import { XernerxInteraction } from '../types/types.js';
|
|
7
7
|
export declare function messageArguments(message: XernerxMessage, command: MessageCommandBuilder): Promise<MessageCommandArguments>;
|
|
8
|
-
export declare function interactionArguments(
|
|
9
|
-
interaction: XernerxInteraction | any,
|
|
10
|
-
command: ContextCommandBuilder | SlashCommandBuilder
|
|
11
|
-
): Promise<{
|
|
12
|
-
args: any;
|
|
13
|
-
group: any;
|
|
14
|
-
subcommand: any;
|
|
15
|
-
}>;
|
|
8
|
+
export declare function interactionArguments(interaction: XernerxInteraction | any, command: ContextCommandBuilder | SlashCommandBuilder): Promise<any>;
|
package/dist/models/Arguments.js
CHANGED
|
@@ -1,35 +1,45 @@
|
|
|
1
1
|
export async function messageArguments(message, command) {
|
|
2
|
-
const separator = command.separator || ' ',
|
|
3
|
-
|
|
4
|
-
let args = {},
|
|
5
|
-
flags = {};
|
|
2
|
+
const separator = command.separator || ' ', content = message.content.split(separator).slice(1);
|
|
3
|
+
let args = {}, flags = {};
|
|
6
4
|
if (command.flags)
|
|
7
5
|
command.flags.map((flag) => {
|
|
8
|
-
if (!flags)
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
if (!flags)
|
|
7
|
+
flags = {};
|
|
8
|
+
if (content.includes(flag.match))
|
|
9
|
+
flags[flag.name] = true;
|
|
10
|
+
else
|
|
11
|
+
flags[flag.name] = false;
|
|
11
12
|
const index = content.indexOf(flag.match);
|
|
12
|
-
if (index > 0)
|
|
13
|
+
if (index > 0)
|
|
14
|
+
content.splice(index, 1);
|
|
13
15
|
});
|
|
14
16
|
if (command.args)
|
|
15
17
|
for (const argument of command.args) {
|
|
16
18
|
const element = content.at(0) || null;
|
|
17
19
|
if (!element) {
|
|
18
|
-
if (typeof argument.default === 'function')
|
|
20
|
+
if (typeof argument.default === 'function')
|
|
21
|
+
args[argument.name] = argument.default(message);
|
|
19
22
|
args[argument.name] = argument.default || null;
|
|
20
23
|
continue;
|
|
21
24
|
}
|
|
22
|
-
if (argument.type === 'option')
|
|
23
|
-
|
|
24
|
-
if (argument.type === '
|
|
25
|
-
|
|
26
|
-
if (argument.type === '
|
|
27
|
-
|
|
25
|
+
if (argument.type === 'option')
|
|
26
|
+
argument.match?.includes(element) ? (args[argument.name] = element) : (args[argument.name] = null);
|
|
27
|
+
if (argument.type === 'number')
|
|
28
|
+
args[argument.name] = parseInt(element);
|
|
29
|
+
if (argument.type === 'integer')
|
|
30
|
+
args[argument.name] = parseInt(element);
|
|
31
|
+
if (argument.type === 'boolean')
|
|
32
|
+
args[argument.name] = element === 'true' ? true : false;
|
|
33
|
+
if (argument.type === 'confirm')
|
|
34
|
+
args[argument.name] = element === 'yes' ? 'yes' : 'no';
|
|
35
|
+
if (argument.type === 'string')
|
|
36
|
+
args[argument.name] = element;
|
|
28
37
|
if (argument.type === 'channel') {
|
|
29
38
|
try {
|
|
30
39
|
const channel = await message.client.channels.fetch(element);
|
|
31
40
|
args[argument.name] = channel;
|
|
32
|
-
}
|
|
41
|
+
}
|
|
42
|
+
catch (e) {
|
|
33
43
|
args[argument.name] = null;
|
|
34
44
|
}
|
|
35
45
|
}
|
|
@@ -37,33 +47,32 @@ export async function messageArguments(message, command) {
|
|
|
37
47
|
try {
|
|
38
48
|
const guild = await message.client.guilds.fetch(element);
|
|
39
49
|
args[argument.name] = guild;
|
|
40
|
-
}
|
|
50
|
+
}
|
|
51
|
+
catch (e) {
|
|
41
52
|
args[argument.name] = null;
|
|
42
53
|
}
|
|
43
54
|
}
|
|
44
55
|
if (argument.type === 'mentionable') {
|
|
45
|
-
(
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
)
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
if (!args) args = {};
|
|
58
|
-
if (mentionable) return (args[argument.name] = mentionable);
|
|
59
|
-
else args[argument.name] = null;
|
|
56
|
+
(await Promise.all([message.guild?.roles, message.client.users, message.client.guilds, message.client.channels, message.guild?.members, message.channel.messages].map((req) => req
|
|
57
|
+
? req
|
|
58
|
+
.fetch(element)
|
|
59
|
+
.then((r) => r)
|
|
60
|
+
.catch(() => null)
|
|
61
|
+
: null))).map((mentionable) => {
|
|
62
|
+
if (!args)
|
|
63
|
+
args = {};
|
|
64
|
+
if (mentionable)
|
|
65
|
+
return (args[argument.name] = mentionable);
|
|
66
|
+
else
|
|
67
|
+
args[argument.name] = null;
|
|
60
68
|
});
|
|
61
69
|
}
|
|
62
70
|
if (argument.type === 'role') {
|
|
63
71
|
try {
|
|
64
72
|
const role = await message.guild?.roles.fetch(element);
|
|
65
73
|
args[argument.name] = role;
|
|
66
|
-
}
|
|
74
|
+
}
|
|
75
|
+
catch (e) {
|
|
67
76
|
args[argument.name] = null;
|
|
68
77
|
}
|
|
69
78
|
}
|
|
@@ -71,7 +80,8 @@ export async function messageArguments(message, command) {
|
|
|
71
80
|
try {
|
|
72
81
|
const user = await message.client.users.fetch(element);
|
|
73
82
|
args[argument.name] = user;
|
|
74
|
-
}
|
|
83
|
+
}
|
|
84
|
+
catch (e) {
|
|
75
85
|
args[argument.name] = null;
|
|
76
86
|
}
|
|
77
87
|
}
|
|
@@ -79,7 +89,8 @@ export async function messageArguments(message, command) {
|
|
|
79
89
|
try {
|
|
80
90
|
const member = await message.guild?.members.fetch(element);
|
|
81
91
|
args[argument.name] = member;
|
|
82
|
-
}
|
|
92
|
+
}
|
|
93
|
+
catch (e) {
|
|
83
94
|
args[argument.name] = null;
|
|
84
95
|
}
|
|
85
96
|
}
|
|
@@ -87,18 +98,20 @@ export async function messageArguments(message, command) {
|
|
|
87
98
|
try {
|
|
88
99
|
const msg = await message.channel?.messages.fetch(element);
|
|
89
100
|
args[argument.name] = msg;
|
|
90
|
-
}
|
|
101
|
+
}
|
|
102
|
+
catch (e) {
|
|
91
103
|
args[argument.name] = null;
|
|
92
104
|
}
|
|
93
105
|
}
|
|
94
106
|
if (argument.type === 'list') {
|
|
95
107
|
let separator = String(argument.separator) || ',';
|
|
96
|
-
if (separator.startsWith('/') && separator.endsWith('/'))
|
|
108
|
+
if (separator.startsWith('/') && separator.endsWith('/'))
|
|
109
|
+
separator = separator.replace(/^\/|\/$/gim, '');
|
|
97
110
|
const items = content.join(' ').split(new RegExp(' *' + separator + ' *', 'gi'));
|
|
98
|
-
if (!argument.content)
|
|
111
|
+
if (!argument.content)
|
|
112
|
+
args[argument.name] = items;
|
|
99
113
|
else {
|
|
100
|
-
const contents = argument.content.map((content) => content.toLowerCase()),
|
|
101
|
-
itemList = [];
|
|
114
|
+
const contents = argument.content.map((content) => content.toLowerCase()), itemList = [];
|
|
102
115
|
items.map((item) => (contents.includes(item.toLowerCase()) ? itemList.push(argument.content?.at(contents.indexOf(item.toLowerCase()))) : null));
|
|
103
116
|
args[argument.name] = itemList;
|
|
104
117
|
break;
|
|
@@ -110,20 +123,28 @@ export async function messageArguments(message, command) {
|
|
|
110
123
|
}
|
|
111
124
|
content.splice(0, 1);
|
|
112
125
|
}
|
|
113
|
-
if (!command.flags)
|
|
114
|
-
|
|
126
|
+
if (!command.flags)
|
|
127
|
+
flags = null;
|
|
128
|
+
if (!command.args)
|
|
129
|
+
args = null;
|
|
115
130
|
return { args, flags };
|
|
116
131
|
}
|
|
117
132
|
export async function interactionArguments(interaction, command) {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
group = interaction?.options?._group,
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
133
|
+
if (command.fileType === 'SlashCommand') {
|
|
134
|
+
const options = {};
|
|
135
|
+
let args = interaction?.options?._hoistedOptions, group = interaction?.options?._group, subcommand = interaction?.options?._subcommand;
|
|
136
|
+
if (interaction.options._hoistedOptions) {
|
|
137
|
+
for (const option of interaction.options._hoistedOptions) {
|
|
138
|
+
options[option.name] = option.member || option.channel || option.user || option.role || option.value;
|
|
139
|
+
}
|
|
140
|
+
args = options;
|
|
125
141
|
}
|
|
126
|
-
args
|
|
142
|
+
return { args, group, subcommand };
|
|
143
|
+
}
|
|
144
|
+
if (command.fileType === 'ContextCommand') {
|
|
145
|
+
if (command.type === 'user')
|
|
146
|
+
return await interaction.client.users.fetch(interaction.targetId);
|
|
147
|
+
if (command.type === 'message')
|
|
148
|
+
return await interaction.channel.messages.fetch(interaction.targetId);
|
|
127
149
|
}
|
|
128
|
-
return { args, group, subcommand };
|
|
129
150
|
}
|
package/dist/tools/XernerxLog.js
CHANGED
|
@@ -18,12 +18,7 @@ export default class XernerxLog {
|
|
|
18
18
|
}
|
|
19
19
|
ready() {
|
|
20
20
|
this.client.prependOnceListener('ready', async (synced) => {
|
|
21
|
-
this.info(
|
|
22
|
-
`${synced.user.tag} is now online, watching ${this.client.guilds.cache.size} guilds, using ${
|
|
23
|
-
this.client.settings.local ? await this.client.guilds.fetch(this.client.settings.local) : 'none'
|
|
24
|
-
} as local guild.`,
|
|
25
|
-
this.readyLog
|
|
26
|
-
);
|
|
21
|
+
this.info(`${synced.user.tag} is now online, watching ${this.client.guilds.cache.size} guilds, using ${this.client.settings.local ? await this.client.guilds.fetch(this.client.settings.local) : 'none'} as local guild.`, this.readyLog);
|
|
27
22
|
const files = [];
|
|
28
23
|
for (const [id, data] of this.client.commands.message) {
|
|
29
24
|
files.push(data);
|
|
@@ -8,10 +8,14 @@ export interface XernerxUser extends User {
|
|
|
8
8
|
export interface XernerxMember extends GuildMember {
|
|
9
9
|
username: string;
|
|
10
10
|
}
|
|
11
|
-
export interface XernerxGuild extends Guild {
|
|
12
|
-
|
|
13
|
-
export interface
|
|
14
|
-
|
|
11
|
+
export interface XernerxGuild extends Guild {
|
|
12
|
+
}
|
|
13
|
+
export interface XernerxGuildChannel extends GuildChannel {
|
|
14
|
+
}
|
|
15
|
+
export interface XernerxDMChannel extends DMChannel {
|
|
16
|
+
}
|
|
17
|
+
interface XernerxCommand {
|
|
18
|
+
}
|
|
15
19
|
export interface XernerxMessage extends Message, XernerxCommand {
|
|
16
20
|
user: XernerxUser;
|
|
17
21
|
util: MessageUtil;
|
|
@@ -67,14 +67,11 @@ export interface DBLOptions {
|
|
|
67
67
|
}
|
|
68
68
|
export interface XernerxCache {
|
|
69
69
|
messages: Collection<string, string>;
|
|
70
|
-
cooldowns: Collection<
|
|
71
|
-
string
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
createdTimestamp: number;
|
|
76
|
-
}
|
|
77
|
-
>;
|
|
70
|
+
cooldowns: Collection<string, {
|
|
71
|
+
id: string;
|
|
72
|
+
command: string;
|
|
73
|
+
createdTimestamp: number;
|
|
74
|
+
}>;
|
|
78
75
|
}
|
|
79
76
|
interface CommandHandlerOptions {
|
|
80
77
|
directory: string;
|
|
@@ -196,10 +193,7 @@ export interface SlashCommandArgumentOptions {
|
|
|
196
193
|
description: string;
|
|
197
194
|
required?: boolean;
|
|
198
195
|
autocomplete?: boolean;
|
|
199
|
-
choices?: Array<
|
|
200
|
-
name: string;
|
|
201
|
-
value: string;
|
|
202
|
-
}>;
|
|
196
|
+
choices?: Array<Record<string, string>>;
|
|
203
197
|
}
|
|
204
198
|
export interface SlashCommandSubcommandOptions {
|
|
205
199
|
name: string;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,181 +1,13 @@
|
|
|
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 | 'webhookInit' | 'webhookPost' | 'webhookError';
|
|
138
11
|
export type XernerxInteraction = XernerxSlashInteraction | XernerxUserContextInteraction | XernerxMessageContextInteraction;
|
|
139
|
-
export type PermissionNames =
|
|
140
|
-
| 'create instant invite'
|
|
141
|
-
| 'kick members'
|
|
142
|
-
| 'ban members'
|
|
143
|
-
| 'administrator'
|
|
144
|
-
| 'manage channels'
|
|
145
|
-
| 'manage guild'
|
|
146
|
-
| 'add reactions'
|
|
147
|
-
| 'view audit log'
|
|
148
|
-
| 'priority speaker'
|
|
149
|
-
| 'stream'
|
|
150
|
-
| 'view channel'
|
|
151
|
-
| 'send messages'
|
|
152
|
-
| 'send tts messages'
|
|
153
|
-
| 'manage messages'
|
|
154
|
-
| 'embed links'
|
|
155
|
-
| 'attach files'
|
|
156
|
-
| 'read message history'
|
|
157
|
-
| 'mention everyone'
|
|
158
|
-
| 'use external emojis'
|
|
159
|
-
| 'view guild insights'
|
|
160
|
-
| 'connect'
|
|
161
|
-
| 'speak'
|
|
162
|
-
| 'mute members'
|
|
163
|
-
| 'deafen members'
|
|
164
|
-
| 'move members'
|
|
165
|
-
| 'use vad'
|
|
166
|
-
| 'change nickname'
|
|
167
|
-
| 'manage nicknames'
|
|
168
|
-
| 'manage roles'
|
|
169
|
-
| 'manage webhooks'
|
|
170
|
-
| 'manage emojis and stickers'
|
|
171
|
-
| 'use application commands'
|
|
172
|
-
| 'request to speak'
|
|
173
|
-
| 'manage events'
|
|
174
|
-
| 'manage threads'
|
|
175
|
-
| 'create public threads'
|
|
176
|
-
| 'create private threads'
|
|
177
|
-
| 'use external stickers'
|
|
178
|
-
| 'send messages in threads'
|
|
179
|
-
| 'start embedded activities'
|
|
180
|
-
| 'moderate members';
|
|
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';
|
|
181
13
|
export type InhibitorType = 'message' | 'interaction' | 'command' | 'channel' | 'user' | 'member' | 'guild' | 'contextCommand' | 'messageCommand' | 'slashCommand';
|
|
@@ -4,7 +4,7 @@ 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
|
}
|
package/dist/utils/ClientUtil.js
CHANGED
|
@@ -8,22 +8,28 @@ 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
|
}
|
|
@@ -5,6 +5,6 @@ import Util from './Util.js';
|
|
|
5
5
|
export default class InteractionUtil extends Util {
|
|
6
6
|
private interaction;
|
|
7
7
|
constructor(client: XernerxClient, interaction: XernerxInteraction);
|
|
8
|
-
reply(content: MessagePayload): Promise<import(
|
|
8
|
+
reply(content: MessagePayload): Promise<import("discord.js").Message<boolean> | import("discord.js").InteractionResponse<boolean>>;
|
|
9
9
|
delay(time: number): Promise<unknown>;
|
|
10
10
|
}
|
|
@@ -9,7 +9,7 @@ export default class MessageUtil extends Util {
|
|
|
9
9
|
prefix: null | string;
|
|
10
10
|
};
|
|
11
11
|
constructor(client: XernerxClient, message: XernerxMessage);
|
|
12
|
-
reply(content: MessagePayload): Promise<import(
|
|
12
|
+
reply(content: MessagePayload): Promise<import("discord.js").Message<boolean> | undefined>;
|
|
13
13
|
webhookReply(content: MessagePayload, url?: URL, user?: User): Promise<void>;
|
|
14
14
|
delay(time: number): Promise<unknown>;
|
|
15
15
|
}
|