xernerx 3.1.2 → 3.1.4
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/README.md +1 -1
- package/dist/build/ContextCommand.d.ts +0 -1
- package/dist/build/ContextCommand.js +3 -9
- package/dist/build/Event.js +2 -1
- package/dist/build/Inhibitor.js +2 -1
- package/dist/build/MessageCommand.js +2 -1
- package/dist/build/SlashCommand.js +6 -6
- package/dist/client/XernerxClient.d.ts +2 -2
- package/dist/client/XernerxClient.js +2 -1
- package/dist/handlers/WebhookHandler.js +0 -1
- package/dist/interfaces/ClientInterfaces.d.ts +0 -5
- package/dist/interfaces/CommandInterfaces.d.ts +2 -2
- package/dist/main.d.ts +68 -65
- package/dist/main.js +7 -8
- package/dist/models/CommandValidations.js +8 -8
- package/dist/models/Events.js +4 -4
- package/dist/models/Functions.d.ts +1 -1
- package/dist/models/Functions.js +1 -30
- package/dist/tools/XernerxError.d.ts +5 -0
- package/dist/tools/XernerxError.js +8 -0
- package/dist/types/Types.d.ts +5 -1
- package/dist/types/Types.js +5 -0
- package/dist/utils/ClientUtil.js +14 -2
- package/dist/utils/CommandUtil.js +5 -4
- package/package.json +1 -1
- package/dist/models/top.gg.d.ts +0 -1
- package/dist/models/top.gg.js +0 -1
- package/dist/models/webhooks.d.ts +0 -6
- package/dist/models/webhooks.js +0 -5
- package/dist/tools/values.d.ts +0 -1
- package/dist/tools/values.js +0 -1
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ Xernerx is a class based discord.js framework. \[BETA\]
|
|
|
13
13
|
> - Message command handles
|
|
14
14
|
> - Webhook handler for Top.gg
|
|
15
15
|
|
|
16
|
-
You can checkout the docs [here](https://github.
|
|
16
|
+
You can checkout the docs [here](https://thedummi.github.io/xernerx/home.html)
|
|
17
17
|
|
|
18
18
|
## Notes
|
|
19
19
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ContextMenuCommandBuilder, } from "discord.js";
|
|
2
2
|
import { s } from "@sapphire/shapeshift";
|
|
3
|
+
import { XernerxClient } from "../main.js";
|
|
3
4
|
/**
|
|
4
5
|
* @description The command builder for context commands.
|
|
5
6
|
* @param {String} id - The unique ID of the command.
|
|
@@ -27,7 +28,7 @@ export class ContextCommand {
|
|
|
27
28
|
if (options.name)
|
|
28
29
|
this.data.setName(options.name);
|
|
29
30
|
if (options.type)
|
|
30
|
-
this.data.setType(
|
|
31
|
+
this.data.setType(options.type);
|
|
31
32
|
if (options.defaultMemberPermissions)
|
|
32
33
|
this.data.setDefaultMemberPermissions(options.defaultMemberPermissions);
|
|
33
34
|
if (options.DMPermission)
|
|
@@ -66,7 +67,7 @@ export class ContextCommand {
|
|
|
66
67
|
this.userPermissions = options.userPermissions;
|
|
67
68
|
this.clientPermissions = options.clientPermissions;
|
|
68
69
|
this.defer = options.defer;
|
|
69
|
-
this.client =
|
|
70
|
+
this.client = XernerxClient;
|
|
70
71
|
this.conditions = this.conditions;
|
|
71
72
|
this.exec = this.exec;
|
|
72
73
|
}
|
|
@@ -80,11 +81,4 @@ export class ContextCommand {
|
|
|
80
81
|
* @description Make your custom command here.
|
|
81
82
|
*/
|
|
82
83
|
async exec(interaction) { }
|
|
83
|
-
#types(type) {
|
|
84
|
-
if (String(type)?.toLowerCase() === "message")
|
|
85
|
-
type = 3;
|
|
86
|
-
if (String(type)?.toLowerCase() === "user")
|
|
87
|
-
type = 2;
|
|
88
|
-
return type;
|
|
89
|
-
}
|
|
90
84
|
}
|
package/dist/build/Event.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { s } from "@sapphire/shapeshift";
|
|
2
|
+
import { XernerxClient } from "../main.js";
|
|
2
3
|
/**
|
|
3
4
|
* @description - The event builder for any events.
|
|
4
5
|
* @param {String} id - The unique ID of the event.
|
|
@@ -23,7 +24,7 @@ export class Event {
|
|
|
23
24
|
this.emitter = options.emitter || "client";
|
|
24
25
|
this.type = options.type || "discord";
|
|
25
26
|
this.once = options.once || false;
|
|
26
|
-
this.client =
|
|
27
|
+
this.client = XernerxClient;
|
|
27
28
|
this.run = this.run;
|
|
28
29
|
}
|
|
29
30
|
async run() {
|
package/dist/build/Inhibitor.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { s } from "@sapphire/shapeshift";
|
|
2
|
+
import { XernerxClient } from "../main.js";
|
|
2
3
|
/**
|
|
3
4
|
* @description - The inhibitor builder for inhibitors.
|
|
4
5
|
* @param {String} id - The unique ID of the inhibitor.
|
|
@@ -17,7 +18,7 @@ export class Inhibitor {
|
|
|
17
18
|
}).parse(options);
|
|
18
19
|
this.name = options.name;
|
|
19
20
|
this.type = options.type;
|
|
20
|
-
this.client =
|
|
21
|
+
this.client = XernerxClient;
|
|
21
22
|
this.check = this.check;
|
|
22
23
|
}
|
|
23
24
|
async check() { }
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { s } from "@sapphire/shapeshift";
|
|
2
|
+
import { XernerxClient } from "../main.js";
|
|
2
3
|
/**
|
|
3
4
|
* @description - The command builder for message commands.
|
|
4
5
|
* @param {String} id - The unique ID of the command.
|
|
@@ -62,7 +63,7 @@ export class MessageCommand {
|
|
|
62
63
|
this.userPermissions = options.userPermissions || [];
|
|
63
64
|
this.clientPermissions = options.clientPermissions || [];
|
|
64
65
|
this.args = options.args;
|
|
65
|
-
this.client =
|
|
66
|
+
this.client = XernerxClient;
|
|
66
67
|
this.conditions = this.conditions;
|
|
67
68
|
this.exec = this.exec;
|
|
68
69
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { SlashCommandBuilder, SlashCommandSubcommandBuilder, SlashCommandSubcommandGroupBuilder, } from "discord.js";
|
|
2
2
|
import { s } from "@sapphire/shapeshift";
|
|
3
|
+
import { XernerxClient } from "../main.js";
|
|
4
|
+
import XernerxError from "../tools/XernerxError.js";
|
|
3
5
|
/**
|
|
4
6
|
* @description - The command builder for slash commands.
|
|
5
7
|
* @param {String} id - The unique ID of the command.
|
|
@@ -68,7 +70,7 @@ export class SlashCommand {
|
|
|
68
70
|
this.userPermissions = options.userPermissions;
|
|
69
71
|
this.clientPermissions = options.clientPermissions;
|
|
70
72
|
this.defer = options.defer;
|
|
71
|
-
this.client =
|
|
73
|
+
this.client = XernerxClient;
|
|
72
74
|
this.conditions = this.conditions;
|
|
73
75
|
this.exec = this.exec;
|
|
74
76
|
}
|
|
@@ -87,11 +89,9 @@ export class SlashCommand {
|
|
|
87
89
|
];
|
|
88
90
|
for (const argument of args) {
|
|
89
91
|
if (!types.includes(argument.type.toLowerCase()))
|
|
90
|
-
throw new
|
|
91
|
-
let
|
|
92
|
-
|
|
93
|
-
.toUpperCase()}${argument.type.slice(1).toLowerCase()}`;
|
|
94
|
-
command[`add${niceType}Option`]((option) => {
|
|
92
|
+
throw new XernerxError(`Expected one of ${types.join(", ")}, received ${argument.type} instead.`);
|
|
93
|
+
let slashArgumentType = `${argument.type.slice(0, 1).toUpperCase()}${argument.type.slice(1).toLowerCase()}`;
|
|
94
|
+
command[(`add${slashArgumentType}Option`)]((option) => {
|
|
95
95
|
option
|
|
96
96
|
.setName(argument.name)
|
|
97
97
|
.setDescription(argument.description)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Client, Collection } from "discord.js";
|
|
2
2
|
import { ClientUtil } from "../utils/ClientUtil.js";
|
|
3
|
-
import { DiscordOptions, ClientOptions,
|
|
3
|
+
import { DiscordOptions, ClientOptions, Commands, Cache, Modules, HandlerOptions } from "../interfaces/ClientInterfaces.js";
|
|
4
4
|
/**
|
|
5
5
|
* @description - The Client.
|
|
6
6
|
* @param {DiscordOptions} discordOptions - The options for discord.js.
|
|
@@ -17,6 +17,6 @@ export default class XernerxClient extends Client {
|
|
|
17
17
|
events: Collection<string, object>;
|
|
18
18
|
inhibitors: Collection<string, object>;
|
|
19
19
|
config: object;
|
|
20
|
-
constructor(discordOptions: DiscordOptions, clientOptions: ClientOptions,
|
|
20
|
+
constructor(discordOptions: DiscordOptions, clientOptions: ClientOptions, config?: object);
|
|
21
21
|
register(token: string): void;
|
|
22
22
|
}
|
|
@@ -22,7 +22,7 @@ export default class XernerxClient extends Client {
|
|
|
22
22
|
events;
|
|
23
23
|
inhibitors;
|
|
24
24
|
config;
|
|
25
|
-
constructor(discordOptions, clientOptions,
|
|
25
|
+
constructor(discordOptions, clientOptions, config) {
|
|
26
26
|
super(discordOptions);
|
|
27
27
|
this.settings = s
|
|
28
28
|
.object({
|
|
@@ -67,6 +67,7 @@ export default class XernerxClient extends Client {
|
|
|
67
67
|
console.info(Style.log(`Xernerx | ${client.user.tag} signed in watching ${size} server${size > 1 ? "s" : ""}. ${(this.handlerOptions.slash || this.handlerOptions.context)?.guildId ? `Using ${(await this.guilds.fetch((this.handlerOptions.slash || this.handlerOptions.context)?.guildId || "0")).name} as local guild.` : ""}`, { color: Style.TextColor.Purple }));
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
|
+
this.register = this.register;
|
|
70
71
|
}
|
|
71
72
|
register(token) {
|
|
72
73
|
this.login(token);
|
|
@@ -32,11 +32,6 @@ export interface ClientOptions {
|
|
|
32
32
|
cache?: number;
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
|
-
export interface DBLOptions {
|
|
36
|
-
token?: string;
|
|
37
|
-
webhook?: string;
|
|
38
|
-
logging?: boolean;
|
|
39
|
-
}
|
|
40
35
|
export interface HandlerOptions {
|
|
41
36
|
message?: MessageCommandOptions;
|
|
42
37
|
slash?: SlashCommandOptions;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ChannelType, ContextMenuCommandType } from "discord.js";
|
|
2
|
+
import { ContextCommandType } from "../types/Types.js";
|
|
2
3
|
export interface MessageCommandOptions {
|
|
3
4
|
name: string;
|
|
4
5
|
regex?: string;
|
|
@@ -21,13 +22,12 @@ export interface MessageCommandOptions {
|
|
|
21
22
|
}
|
|
22
23
|
export interface ContextCommandOptions {
|
|
23
24
|
name: string;
|
|
24
|
-
type: ContextMenuCommandType | number;
|
|
25
|
+
type: ContextMenuCommandType | number | ContextCommandType;
|
|
25
26
|
description?: string;
|
|
26
27
|
info?: string;
|
|
27
28
|
category?: string;
|
|
28
29
|
owner?: boolean;
|
|
29
30
|
channelType?: ChannelType;
|
|
30
|
-
separator?: string;
|
|
31
31
|
cooldown?: number;
|
|
32
32
|
ignoreOwner?: boolean;
|
|
33
33
|
channels?: string[];
|
package/dist/main.d.ts
CHANGED
|
@@ -1,84 +1,87 @@
|
|
|
1
1
|
import Discord from "discord.js";
|
|
2
|
-
import
|
|
2
|
+
import DumFunctions from "dumfunctions";
|
|
3
3
|
import XernerxClient from "./client/XernerxClient.js";
|
|
4
4
|
import { Event } from "./build/Event.js";
|
|
5
5
|
import { Inhibitor } from "./build/Inhibitor.js";
|
|
6
6
|
import { MessageCommand } from "./build/MessageCommand.js";
|
|
7
7
|
import { ContextCommand } from "./build/ContextCommand.js";
|
|
8
8
|
import { SlashCommand } from "./build/SlashCommand.js";
|
|
9
|
-
import { CommandType, EventEmitterType } from "./types/Types.js";
|
|
9
|
+
import { CommandType, EventEmitterType, ContextCommandType } from "./types/Types.js";
|
|
10
10
|
import { InhibitorType } from "./types/InhibitorTypes.js";
|
|
11
11
|
declare const version: string;
|
|
12
12
|
declare const _default: {
|
|
13
13
|
Discord: typeof Discord;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
14
|
+
DumFunctions: {
|
|
15
|
+
Math: {
|
|
16
|
+
E: number;
|
|
17
|
+
LN10: number;
|
|
18
|
+
LN2: number;
|
|
19
|
+
LOG10E: number;
|
|
20
|
+
LOG2E: number;
|
|
21
|
+
PI: number;
|
|
22
|
+
SQRT1_2: number;
|
|
23
|
+
SQRT2: number;
|
|
24
|
+
abs(number: number): number;
|
|
25
|
+
acos(number: number): number;
|
|
26
|
+
acosh(number: number): number;
|
|
27
|
+
asin(number: number): number;
|
|
28
|
+
asinh(number: number): number;
|
|
29
|
+
atan(number: number): number;
|
|
30
|
+
atan2(x: number, y: number): number;
|
|
31
|
+
atanh(number: number): number;
|
|
32
|
+
cbrt(number: number): number;
|
|
33
|
+
ceil(number: number): number;
|
|
34
|
+
clz32(number: number): number;
|
|
35
|
+
cos(number: number): number;
|
|
36
|
+
cosh(number: number): number;
|
|
37
|
+
dif(...numbers: number[]): number;
|
|
38
|
+
exp(number: number): number;
|
|
39
|
+
expm1(number: number): number;
|
|
40
|
+
floor(number: number): number;
|
|
41
|
+
fround(number: number): number;
|
|
42
|
+
hypot(number: number): number;
|
|
43
|
+
imul(x: number, y: number): number;
|
|
44
|
+
log(number: number): number;
|
|
45
|
+
log10(number: number): number;
|
|
46
|
+
log1p(number: number): number;
|
|
47
|
+
log2(number: number): number;
|
|
48
|
+
max(...numbers: number[]): number;
|
|
49
|
+
min(...numbers: number[]): number;
|
|
50
|
+
pow(x: number, y: number): number;
|
|
51
|
+
random(x?: number | undefined, y?: number | undefined): number;
|
|
52
|
+
round(number: number): number;
|
|
53
|
+
shuffle(...numbers: number[]): number | number[];
|
|
54
|
+
sign(number: number): number;
|
|
55
|
+
sin(number: number): number;
|
|
56
|
+
sinh(number: number): number;
|
|
57
|
+
sum(...numbers: number[]): number;
|
|
58
|
+
sqrt(number: number): number;
|
|
59
|
+
tan(number: number): number;
|
|
60
|
+
tanh(number: number): number;
|
|
61
|
+
trunc(number: number): number;
|
|
62
|
+
};
|
|
63
|
+
Random: {
|
|
64
|
+
number(min: number, max: number): number;
|
|
65
|
+
element(array: object | unknown[]): any;
|
|
66
|
+
"__#1916@#color"(): void;
|
|
67
|
+
};
|
|
68
|
+
Style: {
|
|
69
|
+
TextStyle: typeof import("dumfunctions/dist/models/Style.js").TextStyle;
|
|
70
|
+
TextColor: typeof import("dumfunctions/dist/models/Style.js").TextColor;
|
|
71
|
+
BackgroundColor: typeof import("dumfunctions/dist/models/Style.js").BackgroundColor;
|
|
72
|
+
titleCase(string: string, lowercase?: boolean | undefined): string;
|
|
73
|
+
pascalCase(string: string, lowercase?: boolean | undefined): string;
|
|
74
|
+
stringCase(string: string, lowercase?: boolean | undefined): string;
|
|
75
|
+
phraseCase(string: string, lowercase?: boolean | undefined): string;
|
|
76
|
+
log(text: string, options: import("dumfunctions/dist/models/Style.js").LogOptions): string;
|
|
77
|
+
};
|
|
76
78
|
};
|
|
77
79
|
Client: typeof XernerxClient;
|
|
78
80
|
XernerxClient: typeof XernerxClient;
|
|
79
81
|
CommandType: typeof CommandType;
|
|
80
82
|
EventEmitterType: typeof EventEmitterType;
|
|
81
83
|
InhibitorType: typeof InhibitorType;
|
|
84
|
+
ContextCommandType: typeof ContextCommandType;
|
|
82
85
|
Event: typeof Event;
|
|
83
86
|
MessageCommand: typeof MessageCommand;
|
|
84
87
|
ContextCommand: typeof ContextCommand;
|
|
@@ -87,4 +90,4 @@ declare const _default: {
|
|
|
87
90
|
version: string;
|
|
88
91
|
};
|
|
89
92
|
export default _default;
|
|
90
|
-
export { Discord,
|
|
93
|
+
export { Discord, DumFunctions, XernerxClient, CommandType, EventEmitterType, InhibitorType, ContextCommandType, Event, MessageCommand, ContextCommand, SlashCommand, Inhibitor, version, };
|
package/dist/main.js
CHANGED
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
import Discord from "discord.js";
|
|
2
|
-
import
|
|
2
|
+
import DumFunctions from "dumfunctions";
|
|
3
3
|
import XernerxClient from "./client/XernerxClient.js";
|
|
4
4
|
import { Event } from "./build/Event.js";
|
|
5
5
|
import { Inhibitor } from "./build/Inhibitor.js";
|
|
6
6
|
import { MessageCommand } from "./build/MessageCommand.js";
|
|
7
7
|
import { ContextCommand } from "./build/ContextCommand.js";
|
|
8
8
|
import { SlashCommand } from "./build/SlashCommand.js";
|
|
9
|
-
import { CommandType, EventEmitterType } from "./types/Types.js";
|
|
9
|
+
import { CommandType, EventEmitterType, ContextCommandType } from "./types/Types.js";
|
|
10
10
|
import { InhibitorType } from "./types/InhibitorTypes.js";
|
|
11
|
-
const version = "3.1.
|
|
11
|
+
const version = "3.1.4";
|
|
12
12
|
export default {
|
|
13
13
|
// Imported methods
|
|
14
14
|
Discord,
|
|
15
|
-
|
|
16
|
-
Style,
|
|
17
|
-
Random,
|
|
15
|
+
DumFunctions,
|
|
18
16
|
// Client
|
|
19
17
|
Client: XernerxClient,
|
|
20
18
|
XernerxClient,
|
|
@@ -22,6 +20,7 @@ export default {
|
|
|
22
20
|
CommandType,
|
|
23
21
|
EventEmitterType,
|
|
24
22
|
InhibitorType,
|
|
23
|
+
ContextCommandType,
|
|
25
24
|
// Builds
|
|
26
25
|
Event,
|
|
27
26
|
MessageCommand,
|
|
@@ -33,11 +32,11 @@ export default {
|
|
|
33
32
|
};
|
|
34
33
|
export {
|
|
35
34
|
// Imported methods
|
|
36
|
-
Discord,
|
|
35
|
+
Discord, DumFunctions,
|
|
37
36
|
// Client
|
|
38
37
|
XernerxClient,
|
|
39
38
|
// Types
|
|
40
|
-
CommandType, EventEmitterType, InhibitorType,
|
|
39
|
+
CommandType, EventEmitterType, InhibitorType, ContextCommandType,
|
|
41
40
|
// Builds
|
|
42
41
|
Event, MessageCommand, ContextCommand, SlashCommand, Inhibitor,
|
|
43
42
|
// Constants
|
|
@@ -15,25 +15,25 @@ export default function commandValidation(action, command, client, res = false)
|
|
|
15
15
|
return true;
|
|
16
16
|
else if (command.owner && !client.util.isOwner(user.id)) {
|
|
17
17
|
res = true;
|
|
18
|
-
emit(client, action, "Not an owner", client.settings.ownerId);
|
|
18
|
+
emit(client, action, command, "Not an owner", client.settings.ownerId);
|
|
19
19
|
}
|
|
20
20
|
else if (command.channelType?.length > 0 || command.channelType) {
|
|
21
21
|
if (!Array.isArray(command.channelType))
|
|
22
22
|
command.channelType = [command.channelType];
|
|
23
23
|
if (!command?.channelType?.includes(action.channel?.type)) {
|
|
24
24
|
res = true;
|
|
25
|
-
emit(client, action, "Not the correct channel", command.channelType);
|
|
25
|
+
emit(client, action, command, "Not the correct channel", command.channelType);
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
else if (command.channels?.length > 0 &&
|
|
29
29
|
!command.channels.includes(action.channel?.id)) {
|
|
30
30
|
res = true;
|
|
31
|
-
emit(client, action, "Not a whitelisted channel", command.channels);
|
|
31
|
+
emit(client, action, command, "Not a whitelisted channel", command.channels);
|
|
32
32
|
}
|
|
33
33
|
else if (command.guilds?.length > 0 &&
|
|
34
34
|
!command.guilds.includes(action.guild?.id)) {
|
|
35
35
|
res = true;
|
|
36
|
-
emit(client, action, "Not a whitelisted guild", command.guilds);
|
|
36
|
+
emit(client, action, command, "Not a whitelisted guild", command.guilds);
|
|
37
37
|
}
|
|
38
38
|
else if (action?.guild &&
|
|
39
39
|
(command.userPermissions || client.settings.userPermissions)) {
|
|
@@ -47,7 +47,7 @@ export default function commandValidation(action, command, client, res = false)
|
|
|
47
47
|
});
|
|
48
48
|
if (missing.length > 0) {
|
|
49
49
|
res = true;
|
|
50
|
-
emit(client, action, "Missing User Permissions", missing);
|
|
50
|
+
emit(client, action, command, "Missing User Permissions", missing);
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
else if (action?.guild &&
|
|
@@ -62,13 +62,13 @@ export default function commandValidation(action, command, client, res = false)
|
|
|
62
62
|
});
|
|
63
63
|
if (missing.length > 0) {
|
|
64
64
|
res = true;
|
|
65
|
-
emit(client, action, "Missing Client Permissions", missing);
|
|
65
|
+
emit(client, action, command, "Missing Client Permissions", missing);
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
return res;
|
|
69
69
|
}
|
|
70
|
-
function emit(client, action, reason, extra) {
|
|
71
|
-
return client.emit("commandBlock", action, reason, extra);
|
|
70
|
+
function emit(client, action, command, reason, extra) {
|
|
71
|
+
return client.emit("commandBlock", action, command, reason, extra);
|
|
72
72
|
}
|
|
73
73
|
function inCooldown(user, client, command, action) {
|
|
74
74
|
let res = false, downs = {};
|
package/dist/models/Events.js
CHANGED
|
@@ -77,7 +77,7 @@ export class MessageCommandEvents {
|
|
|
77
77
|
this.client.emit("commandRun", message, cmd);
|
|
78
78
|
}
|
|
79
79
|
catch (error) {
|
|
80
|
-
return this.client.emit("commandError", message, error);
|
|
80
|
+
return this.client.emit("commandError", message, error, cmd);
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
});
|
|
@@ -154,7 +154,7 @@ export class MessageCommandEvents {
|
|
|
154
154
|
this.client.emit("commandRun", message, cmd);
|
|
155
155
|
}
|
|
156
156
|
catch (error) {
|
|
157
|
-
return this.client.emit("commandError", message, error);
|
|
157
|
+
return this.client.emit("commandError", message, error, cmd);
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
160
|
});
|
|
@@ -223,7 +223,7 @@ export class SlashCommandEvents {
|
|
|
223
223
|
this.client.emit("commandRun", interaction, command);
|
|
224
224
|
}
|
|
225
225
|
catch (error) {
|
|
226
|
-
this.client.emit("commandError", interaction, error);
|
|
226
|
+
this.client.emit("commandError", interaction, error, command);
|
|
227
227
|
}
|
|
228
228
|
}
|
|
229
229
|
}
|
|
@@ -268,7 +268,7 @@ export class ContextCommandEvents {
|
|
|
268
268
|
this.client.emit("commandRun", interaction, command);
|
|
269
269
|
}
|
|
270
270
|
catch (error) {
|
|
271
|
-
this.client.emit("commandError", interaction, error);
|
|
271
|
+
this.client.emit("commandError", interaction, error, command);
|
|
272
272
|
}
|
|
273
273
|
}
|
|
274
274
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export {};
|
package/dist/models/Functions.js
CHANGED
|
@@ -1,30 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
if (type.toLowerCase() == "text") {
|
|
3
|
-
if (color.toLowerCase() == "red")
|
|
4
|
-
return `\u001b[0;31m${text}\u001b[0;0m`;
|
|
5
|
-
if (color.toLowerCase() == "green")
|
|
6
|
-
return `\u001b[0;32m${text}\u001b[0;0m`;
|
|
7
|
-
if (color.toLowerCase() == "yellow")
|
|
8
|
-
return `\u001b[0;33m${text}\u001b[0;0m`;
|
|
9
|
-
if (color.toLowerCase() == "blue")
|
|
10
|
-
return `\u001b[0;34m${text}\u001b[0;0m`;
|
|
11
|
-
if (color.toLowerCase() == "purple")
|
|
12
|
-
return `\u001b[0;35m${text}\u001b[0;0m`;
|
|
13
|
-
if (color.toLowerCase() == "cyan")
|
|
14
|
-
return `\u001b[0;36m${text}\u001b[0;0m`;
|
|
15
|
-
}
|
|
16
|
-
if (type.toLowerCase() == `background`) {
|
|
17
|
-
if (color.toLowerCase() == "red")
|
|
18
|
-
return `\u001b[0;41m${text}\u001b[0;0m`;
|
|
19
|
-
if (color.toLowerCase() == "green")
|
|
20
|
-
return `\u001b[0;42m${text}\u001b[0;0m`;
|
|
21
|
-
if (color.toLowerCase() == "yellow")
|
|
22
|
-
return `\u001b[0;43m${text}\u001b[0;0m`;
|
|
23
|
-
if (color.toLowerCase() == "blue")
|
|
24
|
-
return `\u001b[0;44m${text}\u001b[0;0m`;
|
|
25
|
-
if (color.toLowerCase() == "purple")
|
|
26
|
-
return `\u001b[0;45m${text}\u001b[0;0m`;
|
|
27
|
-
if (color.toLowerCase() == "cyan")
|
|
28
|
-
return `\u001b[0;46m${text}\u001b[0;0m`;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
1
|
+
export {};
|
package/dist/types/Types.d.ts
CHANGED
|
@@ -9,6 +9,10 @@ export declare enum CommandType {
|
|
|
9
9
|
SlashCommand = "SlashCommand",
|
|
10
10
|
ContextCommand = "ContextCommand"
|
|
11
11
|
}
|
|
12
|
+
export declare enum ContextCommandType {
|
|
13
|
+
Message = 3,
|
|
14
|
+
User = 2
|
|
15
|
+
}
|
|
12
16
|
export declare enum EventEmitterType {
|
|
13
17
|
Client = "client",
|
|
14
18
|
Rest = "rest",
|
|
@@ -16,7 +20,7 @@ export declare enum EventEmitterType {
|
|
|
16
20
|
}
|
|
17
21
|
export type SlashCommandOptionChoices = SlashCommandStringOption | SlashCommandNumberOption | SlashCommandIntegerOption;
|
|
18
22
|
export type SlashCommandOption = SlashCommandOptionChoices | SlashCommandBooleanOption | SlashCommandUserOption | SlashCommandChannelOption | SlashCommandRoleOption | SlashCommandMentionableOption;
|
|
19
|
-
export type
|
|
23
|
+
export type SlashArgumentTypes = "String" | "Number" | "Boolean" | "User" | "Channel" | "Role" | "Mentionable" | "Integer";
|
|
20
24
|
declare const _default: {
|
|
21
25
|
CommandType: typeof CommandType;
|
|
22
26
|
EventEmitterType: typeof EventEmitterType;
|
package/dist/types/Types.js
CHANGED
|
@@ -9,6 +9,11 @@ export var CommandType;
|
|
|
9
9
|
CommandType["SlashCommand"] = "SlashCommand";
|
|
10
10
|
CommandType["ContextCommand"] = "ContextCommand";
|
|
11
11
|
})(CommandType = CommandType || (CommandType = {}));
|
|
12
|
+
export var ContextCommandType;
|
|
13
|
+
(function (ContextCommandType) {
|
|
14
|
+
ContextCommandType[ContextCommandType["Message"] = 3] = "Message";
|
|
15
|
+
ContextCommandType[ContextCommandType["User"] = 2] = "User";
|
|
16
|
+
})(ContextCommandType = ContextCommandType || (ContextCommandType = {}));
|
|
12
17
|
export var EventEmitterType;
|
|
13
18
|
(function (EventEmitterType) {
|
|
14
19
|
EventEmitterType["Client"] = "client";
|
package/dist/utils/ClientUtil.js
CHANGED
|
@@ -1,7 +1,19 @@
|
|
|
1
|
+
import XernerxError from "../tools/XernerxError.js";
|
|
1
2
|
export class ClientUtil {
|
|
2
3
|
client;
|
|
3
4
|
constructor(client) {
|
|
4
5
|
this.client = client;
|
|
6
|
+
this.uptime = this.uptime;
|
|
7
|
+
this.getSubcommands = this.getSubcommands;
|
|
8
|
+
this.isOwner = this.isOwner;
|
|
9
|
+
this.getAllCommands = this.getAllCommands;
|
|
10
|
+
this.getAllMessageCommands = this.getAllMessageCommands;
|
|
11
|
+
this.getAllSlashCommands = this.getAllSlashCommands;
|
|
12
|
+
this.getAllContextCommands = this.getAllContextCommands;
|
|
13
|
+
this.setPresence = this.setPresence;
|
|
14
|
+
this.getCooldowns = this.getCooldowns;
|
|
15
|
+
this.getCooldownTimers = this.getCooldownTimers;
|
|
16
|
+
this.defer = this.defer;
|
|
5
17
|
}
|
|
6
18
|
uptime(timestamp) {
|
|
7
19
|
if (!timestamp)
|
|
@@ -28,7 +40,7 @@ export class ClientUtil {
|
|
|
28
40
|
}
|
|
29
41
|
getSubcommands(name) {
|
|
30
42
|
if (!name || typeof name !== "string")
|
|
31
|
-
throw new
|
|
43
|
+
throw new XernerxError(`Expected name to be of type string, received ${typeof name} instead!`);
|
|
32
44
|
const commands = [];
|
|
33
45
|
this.getAllCommands()
|
|
34
46
|
.filter((c) => (c.data?.name?.toLowerCase() || c.name?.toLowerCase()) ==
|
|
@@ -94,7 +106,7 @@ export class ClientUtil {
|
|
|
94
106
|
}
|
|
95
107
|
isOwner(userId) {
|
|
96
108
|
if (!userId)
|
|
97
|
-
throw new
|
|
109
|
+
throw new XernerxError("No ID specified");
|
|
98
110
|
let owners = this.client.settings.ownerId;
|
|
99
111
|
if (!owners)
|
|
100
112
|
return false;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ActionRowBuilder, ButtonBuilder, ButtonStyle, EmbedBuilder, StringSelectMenuBuilder, } from "discord.js";
|
|
2
|
+
import XernerxError from "../tools/XernerxError.js";
|
|
2
3
|
export class MessageCommandUtil {
|
|
3
4
|
client;
|
|
4
5
|
message;
|
|
@@ -113,9 +114,9 @@ export class InteractionCommandUtil {
|
|
|
113
114
|
#getCommandName() { }
|
|
114
115
|
selectMenuPaginator(embeds, options) {
|
|
115
116
|
if (!Array.isArray(embeds))
|
|
116
|
-
throw new
|
|
117
|
+
throw new XernerxError(`Expected embeds to be of type array, received ${typeof embeds} instead.`);
|
|
117
118
|
if (embeds.length > 25)
|
|
118
|
-
throw new
|
|
119
|
+
throw new XernerxError(`Max select menu length is 25.`);
|
|
119
120
|
if (typeof options !== "object")
|
|
120
121
|
options = {};
|
|
121
122
|
if (!Array.isArray(options.components))
|
|
@@ -181,9 +182,9 @@ export class InteractionCommandUtil {
|
|
|
181
182
|
}
|
|
182
183
|
buttonPaginator(embeds, options) {
|
|
183
184
|
if (!Array.isArray(embeds))
|
|
184
|
-
throw new
|
|
185
|
+
throw new XernerxError(`Expected embeds to be of type array, received ${typeof embeds} instead.`);
|
|
185
186
|
if (embeds.length <= 0)
|
|
186
|
-
throw new
|
|
187
|
+
throw new XernerxError(`The minimum embeds is 1.`);
|
|
187
188
|
if (typeof options !== "object")
|
|
188
189
|
options = {};
|
|
189
190
|
if (!Array.isArray(options.components))
|
package/package.json
CHANGED
package/dist/models/top.gg.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/models/top.gg.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/models/webhooks.js
DELETED
package/dist/tools/values.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/tools/values.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|