xernerx 4.17.0 → 4.17.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/build/XernerxEvent.d.ts +7 -11
- package/dist/build/XernerxEvent.js +0 -4
- package/dist/build/XernerxMessageCommand.d.ts +1 -5
- package/dist/build/XernerxMessageCommand.js +1 -1
- package/dist/build/XernerxSlashCommand.js +2 -1
- package/dist/client/XernerxClient.d.ts +5 -4
- package/dist/client/XernerxClient.js +1 -2
- package/dist/handlers/CommandHandler.js +5 -5
- package/dist/handlers/EventHandler.js +1 -1
- package/dist/handlers/Handler.d.ts +12 -3
- package/dist/handlers/Handler.js +28 -17
- package/dist/handlers/InhibitorHandler.js +1 -1
- package/dist/tools/XernerxIntents.d.ts +3 -2
- package/dist/tools/XernerxIntents.js +21 -19
- package/dist/types/extenders.d.ts +17 -2
- package/dist/types/interfaces.d.ts +3 -3
- package/dist/types/types.d.ts +0 -2
- package/dist/utils/Util.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,25 +1,21 @@
|
|
|
1
1
|
/** @format */
|
|
2
2
|
import { XernerxEventOptions } from '../types/interfaces.js';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { XernerxClientEvents, XernerxClientType } from '../types/extenders.js';
|
|
4
|
+
import { Awaitable, RestEvents } from 'discord.js';
|
|
5
5
|
/**
|
|
6
6
|
* @description - The event builder for events.
|
|
7
7
|
* @param {String} id - The unique ID of the event.
|
|
8
8
|
* @param {EventOptions} options - The event options.
|
|
9
9
|
*/
|
|
10
|
-
export default class XernerxEvent {
|
|
10
|
+
export default class XernerxEvent<Event extends keyof XernerxClientEvents> {
|
|
11
11
|
readonly id: string;
|
|
12
|
-
readonly name:
|
|
13
|
-
readonly emitter?: 'client' | 'process' | string;
|
|
14
|
-
readonly type?: 'discord' | string;
|
|
12
|
+
readonly name: Event | keyof RestEvents | string;
|
|
13
|
+
readonly emitter?: 'client' | 'process' | 'rest' | string;
|
|
14
|
+
readonly type?: 'discord' | 'node' | string;
|
|
15
15
|
readonly once?: boolean;
|
|
16
16
|
readonly filetype: 'Event';
|
|
17
17
|
readonly filepath: string;
|
|
18
18
|
readonly client: XernerxClientType;
|
|
19
19
|
constructor(id: string, options: XernerxEventOptions);
|
|
20
|
-
|
|
21
|
-
* @description run your custom event here.
|
|
22
|
-
* @param any - there can be all kinds of parameters on events.
|
|
23
|
-
*/
|
|
24
|
-
run(...args: any): Promise<any>;
|
|
20
|
+
run(...args: XernerxClientEvents[Event]): Promise<Awaitable<any>>;
|
|
25
21
|
}
|
|
@@ -21,10 +21,6 @@ export default class XernerxEvent {
|
|
|
21
21
|
this.once = options.once || false;
|
|
22
22
|
this.client = this.client;
|
|
23
23
|
}
|
|
24
|
-
/**
|
|
25
|
-
* @description run your custom event here.
|
|
26
|
-
* @param any - there can be all kinds of parameters on events.
|
|
27
|
-
*/
|
|
28
24
|
async run(...args) {
|
|
29
25
|
return new XernerxLog(this.client).error(`${this.id} doesn't have a run rule.`);
|
|
30
26
|
}
|
|
@@ -34,11 +34,7 @@ export default class XernerxMessageCommand {
|
|
|
34
34
|
} | undefined;
|
|
35
35
|
readonly permissions: {
|
|
36
36
|
user?: string[] | import("../main.js").PermissionNames[] | null | undefined;
|
|
37
|
-
client?: string[] | import("../main.js").PermissionNames[] | null | undefined;
|
|
38
|
-
* @description Checks for conditions before running the command
|
|
39
|
-
* @param message - The message event emitted on this command
|
|
40
|
-
* @param options - The args and flags parsed on this command
|
|
41
|
-
*/
|
|
37
|
+
client?: string[] | import("../main.js").PermissionNames[] | null | undefined;
|
|
42
38
|
dm?: boolean | undefined;
|
|
43
39
|
} | undefined;
|
|
44
40
|
readonly filetype: 'MessageCommand';
|
|
@@ -114,6 +114,6 @@ export default class XernerxMessageCommand {
|
|
|
114
114
|
*/
|
|
115
115
|
async exec(message, { args, flags }) {
|
|
116
116
|
new XernerxLog(this.client).error(`${this.id} doesn't have an execution rule.`);
|
|
117
|
-
return await this.client.emit('commandError', message, `${this.id} doesn't have an execution rule.`, this
|
|
117
|
+
return await this.client.emit('commandError', message, `${this.id} doesn't have an execution rule.`, this);
|
|
118
118
|
}
|
|
119
119
|
}
|
|
@@ -27,6 +27,7 @@ export default class XernerxSlashCommand {
|
|
|
27
27
|
usage: z.string().or(z.null()).default(null),
|
|
28
28
|
info: z.string().or(z.null()).default(null),
|
|
29
29
|
category: z.string().or(z.null()).default(null),
|
|
30
|
+
cooldown: z.number().or(z.null()).default(null),
|
|
30
31
|
number: z.number().or(z.null()).default(null),
|
|
31
32
|
global: z.boolean().default(true),
|
|
32
33
|
channel: z
|
|
@@ -137,7 +138,7 @@ export default class XernerxSlashCommand {
|
|
|
137
138
|
*/
|
|
138
139
|
async exec(interaction, { args, subcommand, group }) {
|
|
139
140
|
new XernerxLog(this.client).error(`${this.id} doesn't have an execution rule.`);
|
|
140
|
-
return await this.client.emit('commandError', interaction, `${this.id} doesn't have an execution rule.`, this
|
|
141
|
+
return await this.client.emit('commandError', interaction, `${this.id} doesn't have an execution rule.`, this);
|
|
141
142
|
}
|
|
142
143
|
addArguments(command, args) {
|
|
143
144
|
for (const argument of args) {
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/** @format */
|
|
2
2
|
import { Client, ClientOptions, Collection } from 'discord.js';
|
|
3
3
|
import { XernerxOptions, ModuleOptions, XernerxCommands, XernerxCache } from '../types/interfaces.js';
|
|
4
|
+
import { XernerxClientEvents } from '../types/extenders.js';
|
|
4
5
|
import ClientUtil from '../utils/ClientUtil.js';
|
|
5
6
|
import XernerxInhibitor from '../build/XernerxInhibitor.js';
|
|
6
7
|
import XernerxEvent from '../build/XernerxEvent.js';
|
|
7
8
|
import Cooldowns from '../models/Cooldowns.js';
|
|
8
|
-
export default class XernerxClient extends Client {
|
|
9
|
+
export default class XernerxClient<T = unknown> extends Client {
|
|
9
10
|
readonly settings: {
|
|
10
11
|
ownerId: (string | string[]) & (string | string[] | undefined);
|
|
11
12
|
local: string;
|
|
@@ -39,9 +40,9 @@ export default class XernerxClient extends Client {
|
|
|
39
40
|
collections: string[];
|
|
40
41
|
} | undefined;
|
|
41
42
|
};
|
|
42
|
-
readonly config:
|
|
43
|
+
readonly config: T;
|
|
43
44
|
readonly commands: XernerxCommands;
|
|
44
|
-
readonly events: Collection<string, XernerxEvent
|
|
45
|
+
readonly events: Collection<string, XernerxEvent<keyof XernerxClientEvents>>;
|
|
45
46
|
readonly inhibitors: Collection<string, XernerxInhibitor>;
|
|
46
47
|
readonly modules: ModuleOptions;
|
|
47
48
|
readonly util: ClientUtil;
|
|
@@ -49,6 +50,6 @@ export default class XernerxClient extends Client {
|
|
|
49
50
|
readonly cache: XernerxCache;
|
|
50
51
|
readonly cooldowns: Cooldowns;
|
|
51
52
|
readonly dbl: any;
|
|
52
|
-
constructor(discordOptions: ClientOptions, xernerxOptions: XernerxOptions, config?:
|
|
53
|
+
constructor(discordOptions: ClientOptions, xernerxOptions: XernerxOptions, config?: T);
|
|
53
54
|
connect(token: string): Promise<string>;
|
|
54
55
|
}
|
|
@@ -57,7 +57,7 @@ export default class XernerxClient extends Client {
|
|
|
57
57
|
.optional(),
|
|
58
58
|
})
|
|
59
59
|
.parse(xernerxOptions);
|
|
60
|
-
this.config = config
|
|
60
|
+
this.config = config;
|
|
61
61
|
this.commands = {
|
|
62
62
|
message: new Collection(),
|
|
63
63
|
slash: new Collection(),
|
|
@@ -87,7 +87,6 @@ export default class XernerxClient extends Client {
|
|
|
87
87
|
integrationHandler: new IntegrationHandler(this),
|
|
88
88
|
extensionHandler: new ExtensionHandler(this),
|
|
89
89
|
};
|
|
90
|
-
return this;
|
|
91
90
|
}
|
|
92
91
|
async connect(token) {
|
|
93
92
|
const login = this.login(token);
|
|
@@ -42,7 +42,7 @@ export default class CommandHandler extends Handler {
|
|
|
42
42
|
})
|
|
43
43
|
.parse(options);
|
|
44
44
|
this.client.modules.options.message = options;
|
|
45
|
-
const files = this.readdir(options.directory);
|
|
45
|
+
const files = this.readdir(options.directory, 'MessageCommands');
|
|
46
46
|
for (const file of files) {
|
|
47
47
|
const filepath = `${path.resolve(options.directory)}\\${file}`;
|
|
48
48
|
const command = await this.load(filepath, 'MessageCommand');
|
|
@@ -107,7 +107,7 @@ export default class CommandHandler extends Handler {
|
|
|
107
107
|
})
|
|
108
108
|
.parse(options);
|
|
109
109
|
this.client.modules.options.slash = options;
|
|
110
|
-
const files = this.readdir(options.directory);
|
|
110
|
+
const files = this.readdir(options.directory, 'SlashCommands');
|
|
111
111
|
for (const file of files) {
|
|
112
112
|
const filepath = `${path.resolve(options.directory)}\\${file}`;
|
|
113
113
|
const command = await this.load(filepath, 'SlashCommand');
|
|
@@ -146,7 +146,7 @@ export default class CommandHandler extends Handler {
|
|
|
146
146
|
})
|
|
147
147
|
.parse(options);
|
|
148
148
|
this.client.modules.options.context = options;
|
|
149
|
-
const files = this.readdir(options.directory);
|
|
149
|
+
const files = this.readdir(options.directory, 'ContextCommands');
|
|
150
150
|
for (const file of files) {
|
|
151
151
|
const filepath = `${path.resolve(options.directory)}\\${file}`;
|
|
152
152
|
const command = await this.load(filepath, 'ContextCommand');
|
|
@@ -291,7 +291,7 @@ export default class CommandHandler extends Handler {
|
|
|
291
291
|
cmd.util = interaction.util;
|
|
292
292
|
return await this.exec(cmd, interaction, args, filetype);
|
|
293
293
|
})
|
|
294
|
-
.catch((error) => this.client.emit('commandError', interaction, error, cmd
|
|
294
|
+
.catch((error) => this.client.emit('commandError', interaction, error, cmd));
|
|
295
295
|
}
|
|
296
296
|
async contextCommandRun(interaction) {
|
|
297
297
|
const filetype = 'ContextCommand';
|
|
@@ -337,7 +337,7 @@ export default class CommandHandler extends Handler {
|
|
|
337
337
|
}
|
|
338
338
|
catch (error) {
|
|
339
339
|
new XernerxLog(this.client).error(`An error occurred executing ${Style.log(cmd.name, { color: Style.TextColor.Blue })}`, error);
|
|
340
|
-
return await this.client.emit('commandError', event, error, cmd
|
|
340
|
+
return await this.client.emit('commandError', event, error, cmd);
|
|
341
341
|
}
|
|
342
342
|
}
|
|
343
343
|
_checks(command) {
|
|
@@ -17,7 +17,7 @@ export default class EventHandler extends Handler {
|
|
|
17
17
|
})
|
|
18
18
|
.parse(options);
|
|
19
19
|
this.client.modules.options.events = options;
|
|
20
|
-
const files = this.readdir(options.directory);
|
|
20
|
+
const files = this.readdir(options.directory, 'Events');
|
|
21
21
|
for (const file of files) {
|
|
22
22
|
const filepath = `${path.resolve(options.directory)}\\${file}`;
|
|
23
23
|
const event = await this.load(filepath, 'Event');
|
|
@@ -4,11 +4,20 @@ import MessageCommandBuilder from '../build/XernerxMessageCommand.js';
|
|
|
4
4
|
import XernerxSlashCommand from '../build/XernerxSlashCommand.js';
|
|
5
5
|
import XernerxContextCommand from '../build/XernerxContextCommand.js';
|
|
6
6
|
import { filetype } from '../types/types.js';
|
|
7
|
+
import { XernerxClientEvents, XernerxEvent, XernerxInhibitor } from '../main.js';
|
|
7
8
|
export default class Handler {
|
|
8
|
-
readonly client: XernerxClient
|
|
9
|
+
readonly client: XernerxClient<unknown>;
|
|
9
10
|
readonly files: Array<MessageCommandBuilder | XernerxSlashCommand | XernerxContextCommand>;
|
|
10
11
|
constructor(client: XernerxClient);
|
|
11
|
-
readdir(dir: string): string[];
|
|
12
|
+
readdir(dir: string, type: string): string[];
|
|
12
13
|
load(filepath: string, type: filetype): Promise<any>;
|
|
13
|
-
|
|
14
|
+
/**
|
|
15
|
+
* Emits a file that has been loaded into the handler.
|
|
16
|
+
* @param file - The file to emit.
|
|
17
|
+
*/
|
|
18
|
+
emit<File extends {
|
|
19
|
+
name: string;
|
|
20
|
+
filetype: 'MessageCommand' | 'SlashCommand' | 'ContextCommand';
|
|
21
|
+
run: Function;
|
|
22
|
+
} | XernerxInhibitor | XernerxEvent<keyof XernerxClientEvents>>(file: File): Promise<void>;
|
|
14
23
|
}
|
package/dist/handlers/Handler.js
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
import * as fs from 'fs';
|
|
3
3
|
import * as path from 'path';
|
|
4
4
|
import load from '../functions/load.js';
|
|
5
|
+
import { Style } from '../main.js';
|
|
6
|
+
import XernerxLog from '../tools/XernerxLog.js';
|
|
5
7
|
export default class Handler {
|
|
6
8
|
client;
|
|
7
9
|
files;
|
|
@@ -9,12 +11,12 @@ export default class Handler {
|
|
|
9
11
|
this.client = client;
|
|
10
12
|
this.files = [];
|
|
11
13
|
}
|
|
12
|
-
readdir(dir) {
|
|
14
|
+
readdir(dir, type) {
|
|
13
15
|
try {
|
|
14
16
|
return fs.readdirSync(path.resolve(dir)).filter((file) => file.endsWith('.js'));
|
|
15
17
|
}
|
|
16
18
|
catch (error) {
|
|
17
|
-
|
|
19
|
+
new XernerxLog(this.client).error(`Cannot load ${type.toLowerCase()}, there is no such directory ${Style.log(dir, { color: Style.BackgroundColor.Grey })}.`);
|
|
18
20
|
}
|
|
19
21
|
return [];
|
|
20
22
|
}
|
|
@@ -23,23 +25,32 @@ export default class Handler {
|
|
|
23
25
|
this.files.push(file);
|
|
24
26
|
return file;
|
|
25
27
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
/**
|
|
29
|
+
* Emits a file that has been loaded into the handler.
|
|
30
|
+
* @param file - The file to emit.
|
|
31
|
+
*/
|
|
32
|
+
async emit(file) {
|
|
33
|
+
if (!file?.filetype)
|
|
28
34
|
return;
|
|
29
|
-
if (
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
if (file.filetype === 'Inhibitor')
|
|
36
|
+
return;
|
|
37
|
+
if (file.filetype === 'Event' && file.emitter) {
|
|
38
|
+
if (file.emitter === 'client') {
|
|
39
|
+
this.client[file.once ? 'once' : 'on'](file.name, (...args) => file.run(...args));
|
|
40
|
+
}
|
|
41
|
+
else if (file.emitter === 'process') {
|
|
42
|
+
process[file.once ? 'once' : 'on'](file.name, (...args) => file.run(...args));
|
|
43
|
+
}
|
|
44
|
+
else if (file.emitter === 'rest') {
|
|
45
|
+
this.client.rest[file.once ? 'once' : 'on'](file.name, (...args) => file.run(...args));
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
// @ts-expect-error
|
|
49
|
+
this.client[file.emitter][file.once ? 'once' : 'on'](file.name, (...args) => file.run(...args));
|
|
50
|
+
}
|
|
38
51
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
? this.client.once(event.name, (...args) => event.run(...args))
|
|
42
|
-
: this.client.on(event.name, (...args) => event.run(...args));
|
|
52
|
+
else {
|
|
53
|
+
this.client.on(file.name, (...args) => file.run(...args));
|
|
43
54
|
}
|
|
44
55
|
}
|
|
45
56
|
}
|
|
@@ -17,7 +17,7 @@ export default class InhibitorHandler extends Handler {
|
|
|
17
17
|
})
|
|
18
18
|
.parse(options);
|
|
19
19
|
this.client.modules.options.inhibitors = options;
|
|
20
|
-
const files = this.readdir(options.directory);
|
|
20
|
+
const files = this.readdir(options.directory, 'Inhibitors');
|
|
21
21
|
for (const file of files) {
|
|
22
22
|
const filepath = `${path.resolve(options.directory)}\\${file}`;
|
|
23
23
|
const inhibitor = await this.load(filepath, 'Inhibitor');
|
|
@@ -1,24 +1,26 @@
|
|
|
1
1
|
/** @format */
|
|
2
|
+
import { GatewayIntentBits } from 'discord.js';
|
|
2
3
|
export const XernerxIntents = {
|
|
3
4
|
Default: [
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
5
|
+
GatewayIntentBits.Guilds,
|
|
6
|
+
GatewayIntentBits.GuildModeration,
|
|
7
|
+
GatewayIntentBits.GuildBans,
|
|
8
|
+
GatewayIntentBits.GuildModeration,
|
|
9
|
+
GatewayIntentBits.GuildEmojisAndStickers,
|
|
10
|
+
GatewayIntentBits.GuildIntegrations,
|
|
11
|
+
GatewayIntentBits.GuildWebhooks,
|
|
12
|
+
GatewayIntentBits.GuildInvites,
|
|
13
|
+
GatewayIntentBits.GuildVoiceStates,
|
|
14
|
+
GatewayIntentBits.GuildMessages,
|
|
15
|
+
GatewayIntentBits.GuildMessageReactions,
|
|
16
|
+
GatewayIntentBits.GuildMessageTyping,
|
|
17
|
+
GatewayIntentBits.DirectMessages,
|
|
18
|
+
GatewayIntentBits.DirectMessageReactions,
|
|
19
|
+
GatewayIntentBits.DirectMessageTyping,
|
|
20
|
+
GatewayIntentBits.GuildScheduledEvents,
|
|
21
|
+
GatewayIntentBits.AutoModerationConfiguration,
|
|
22
|
+
GatewayIntentBits.AutoModerationExecution,
|
|
21
23
|
],
|
|
22
|
-
All: [
|
|
24
|
+
All: [GatewayIntentBits.GuildMembers, GatewayIntentBits.GuildPresences, GatewayIntentBits.MessageContent],
|
|
23
25
|
};
|
|
24
|
-
XernerxIntents.All
|
|
26
|
+
XernerxIntents.All.push(...XernerxIntents.Default);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** @format */
|
|
2
|
-
import { ChatInputCommandInteraction, Collection, DMChannel, Guild, GuildChannel, GuildMember, Message, MessageContextMenuCommandInteraction, User, UserContextMenuCommandInteraction } from 'discord.js';
|
|
2
|
+
import { ChatInputCommandInteraction, Collection, DMChannel, Guild, GuildChannel, GuildMember, Message, MessageContextMenuCommandInteraction, User, UserContextMenuCommandInteraction, ClientEvents } from 'discord.js';
|
|
3
3
|
import InteractionUtil from '../utils/InteractionUtil.js';
|
|
4
4
|
import MessageUtil from '../utils/MessageUtil.js';
|
|
5
5
|
import { ModuleOptions, XernerxCache, XernerxCommands } from '../types/interfaces.js';
|
|
@@ -7,6 +7,8 @@ import XernerxEvent from '../build/XernerxEvent.js';
|
|
|
7
7
|
import XernerxInhibitor from '../build/XernerxInhibitor.js';
|
|
8
8
|
import XernerxClient from '../client/XernerxClient.js';
|
|
9
9
|
import ClientUtil from '../utils/ClientUtil.js';
|
|
10
|
+
import { XernerxContextCommand, XernerxMessageCommand, XernerxSlashCommand } from '../main.js';
|
|
11
|
+
import XernerxError from '../tools/XernerxError.js';
|
|
10
12
|
export interface XernerxUser extends User {
|
|
11
13
|
owner: boolean;
|
|
12
14
|
voted: boolean | null;
|
|
@@ -40,7 +42,7 @@ export interface XernerxMessageContextInteraction extends MessageContextMenuComm
|
|
|
40
42
|
}
|
|
41
43
|
export interface XernerxClientType extends XernerxClient {
|
|
42
44
|
commands: XernerxCommands;
|
|
43
|
-
events: Collection<string, XernerxEvent
|
|
45
|
+
events: Collection<string, XernerxEvent<keyof XernerxClientEvents>>;
|
|
44
46
|
inhibitors: Collection<string, XernerxInhibitor>;
|
|
45
47
|
modules: ModuleOptions;
|
|
46
48
|
util: ClientUtil;
|
|
@@ -58,4 +60,17 @@ export interface XernerxClientType extends XernerxClient {
|
|
|
58
60
|
cache: XernerxCache;
|
|
59
61
|
connect: () => Promise<string>;
|
|
60
62
|
}
|
|
63
|
+
interface CommandBlockInfo {
|
|
64
|
+
reason: string;
|
|
65
|
+
message: string;
|
|
66
|
+
required: Array<string> | string;
|
|
67
|
+
missing: Array<string> | string;
|
|
68
|
+
}
|
|
69
|
+
export interface XernerxClientEvents extends ClientEvents {
|
|
70
|
+
commandBlock: [event: XernerxMessage | XernerxSlashInteraction, info: CommandBlockInfo, command: XernerxSlashCommand | XernerxMessageCommand | XernerxContextCommand];
|
|
71
|
+
commandError: [event: XernerxMessage | XernerxSlashInteraction, error: XernerxError, command: XernerxSlashCommand | XernerxMessageCommand | XernerxContextCommand];
|
|
72
|
+
commandStart: [event: XernerxMessage | XernerxSlashInteraction, command: XernerxSlashCommand | XernerxMessageCommand | XernerxContextCommand];
|
|
73
|
+
commandFinish: [event: XernerxMessage | XernerxSlashInteraction, command: XernerxSlashCommand | XernerxMessageCommand | XernerxContextCommand];
|
|
74
|
+
commandNotFound: [event: XernerxMessage | XernerxSlashInteraction, commandName: string, filetype: 'MessageCommand' | 'SlashCommand' | 'ContextCommand'];
|
|
75
|
+
}
|
|
61
76
|
export {};
|
|
@@ -7,9 +7,9 @@ import IntegrationHandler from '../handlers/IntegrationHandler.js';
|
|
|
7
7
|
import XernerxContextCommand from '../build/XernerxContextCommand.js';
|
|
8
8
|
import MessageCommandBuilder from '../build/XernerxMessageCommand.js';
|
|
9
9
|
import XernerxSlashCommand from '../build/XernerxSlashCommand.js';
|
|
10
|
-
import { Locales, MessageCommandArgumentType, PermissionNames, SlashCommandArgumentType,
|
|
10
|
+
import { Locales, MessageCommandArgumentType, PermissionNames, SlashCommandArgumentType, InhibitorType } from './types.js';
|
|
11
11
|
import ExtensionHandler from '../handlers/ExtensionHandler.js';
|
|
12
|
-
import { XernerxMessage, XernerxUser } from './extenders.js';
|
|
12
|
+
import { XernerxClientEvents, XernerxMessage, XernerxUser } from './extenders.js';
|
|
13
13
|
export interface XernerxOptions {
|
|
14
14
|
local: string;
|
|
15
15
|
global?: boolean;
|
|
@@ -223,7 +223,7 @@ export interface SlashCommandArguments<T = SlashCommandArgumentType> {
|
|
|
223
223
|
group: string;
|
|
224
224
|
}
|
|
225
225
|
export interface XernerxEventOptions {
|
|
226
|
-
name:
|
|
226
|
+
name: keyof XernerxClientEvents;
|
|
227
227
|
emitter?: 'client' | 'process';
|
|
228
228
|
type?: 'discord' | 'node';
|
|
229
229
|
once?: boolean;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -7,8 +7,6 @@ export type SlashCommandArgumentType = 'attachment' | 'boolean' | 'channel' | 'i
|
|
|
7
7
|
export type SlashCommandOptionChoices = SlashCommandStringOption | SlashCommandNumberOption | SlashCommandIntegerOption;
|
|
8
8
|
export type SlashCommandOption = SlashCommandOptionChoices | SlashCommandBooleanOption | SlashCommandUserOption | SlashCommandChannelOption | SlashCommandRoleOption | SlashCommandMentionableOption;
|
|
9
9
|
export type MessageCommandArgumentType = 'string' | 'number' | 'boolean' | 'confirm' | 'channel' | 'guild' | 'integer' | 'mentionable' | 'role' | 'user' | 'message' | 'member' | 'list' | 'option' | 'rest';
|
|
10
|
-
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';
|
|
11
|
-
export type XernerxEventType = DiscordEventType | 'webhookCreate' | 'webhookError' | 'commandBlock' | 'commandError' | 'commandStart' | 'commandFinish' | 'commandCooldown';
|
|
12
10
|
export type XernerxInteraction<T extends XernerxSlashInteraction | XernerxUserContextInteraction | XernerxMessageContextInteraction> = T extends XernerxSlashInteraction ? XernerxSlashInteraction : T extends XernerxUserContextInteraction ? XernerxUserContextInteraction : XernerxMessageContextInteraction;
|
|
13
11
|
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';
|
|
14
12
|
export type InhibitorType = '*' | 'message' | 'interaction' | 'command' | 'channel' | 'user' | 'member' | 'guild' | 'contextCommand' | 'messageCommand' | 'slashCommand';
|
package/dist/utils/Util.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import XernerxClient from '../client/XernerxClient.js';
|
|
3
3
|
import XernerxText from '../tools/XernerxText.js';
|
|
4
4
|
export default class Util {
|
|
5
|
-
readonly client: XernerxClient
|
|
5
|
+
readonly client: XernerxClient<unknown>;
|
|
6
6
|
readonly text: XernerxText;
|
|
7
7
|
constructor(client: XernerxClient);
|
|
8
8
|
delay(time: number): Promise<unknown>;
|