xernerx 3.1.1 → 3.1.3
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/SlashCommand.js +4 -5
- package/dist/client/XernerxClient.d.ts +2 -2
- package/dist/client/XernerxClient.js +1 -1
- package/dist/handlers/WebhookHandler.js +4 -9
- package/dist/interfaces/ClientInterfaces.d.ts +0 -5
- package/dist/main.d.ts +66 -64
- package/dist/main.js +3 -5
- package/dist/tools/XernerxError.d.ts +5 -0
- package/dist/tools/XernerxError.js +8 -0
- package/dist/types/Types.d.ts +1 -1
- package/dist/utils/ClientUtil.js +3 -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
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { SlashCommandBuilder, SlashCommandSubcommandBuilder, SlashCommandSubcommandGroupBuilder, } from "discord.js";
|
|
2
2
|
import { s } from "@sapphire/shapeshift";
|
|
3
|
+
import XernerxError from "../tools/XernerxError.js";
|
|
3
4
|
/**
|
|
4
5
|
* @description - The command builder for slash commands.
|
|
5
6
|
* @param {String} id - The unique ID of the command.
|
|
@@ -87,11 +88,9 @@ export class SlashCommand {
|
|
|
87
88
|
];
|
|
88
89
|
for (const argument of args) {
|
|
89
90
|
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) => {
|
|
91
|
+
throw new XernerxError(`Expected one of ${types.join(", ")}, received ${argument.type} instead.`);
|
|
92
|
+
let slashArgumentType = `${argument.type.slice(0, 1).toUpperCase()}${argument.type.slice(1).toLowerCase()}`;
|
|
93
|
+
command[(`add${slashArgumentType}Option`)]((option) => {
|
|
95
94
|
option
|
|
96
95
|
.setName(argument.name)
|
|
97
96
|
.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({
|
|
@@ -28,14 +28,9 @@ export default class WebhookHandler {
|
|
|
28
28
|
vote(options) {
|
|
29
29
|
const app = express();
|
|
30
30
|
const webhook = new SDK.Webhook(options.token);
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
// catch (error) {
|
|
36
|
-
// return this.client.emit("webhookError", error)
|
|
37
|
-
// }
|
|
38
|
-
// }))
|
|
39
|
-
app.listen(4444);
|
|
31
|
+
app.post("/dblwebhook", webhook.listener(vote => {
|
|
32
|
+
console.log(vote);
|
|
33
|
+
}));
|
|
34
|
+
app.listen(80);
|
|
40
35
|
}
|
|
41
36
|
}
|
|
@@ -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;
|
package/dist/main.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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";
|
|
@@ -11,68 +11,70 @@ 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;
|
|
@@ -87,4 +89,4 @@ declare const _default: {
|
|
|
87
89
|
version: string;
|
|
88
90
|
};
|
|
89
91
|
export default _default;
|
|
90
|
-
export { Discord,
|
|
92
|
+
export { Discord, DumFunctions, XernerxClient, CommandType, EventEmitterType, InhibitorType, Event, MessageCommand, ContextCommand, SlashCommand, Inhibitor, version, };
|
package/dist/main.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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";
|
|
@@ -12,9 +12,7 @@ const version = "3.1.1";
|
|
|
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,
|
|
@@ -33,7 +31,7 @@ export default {
|
|
|
33
31
|
};
|
|
34
32
|
export {
|
|
35
33
|
// Imported methods
|
|
36
|
-
Discord,
|
|
34
|
+
Discord, DumFunctions,
|
|
37
35
|
// Client
|
|
38
36
|
XernerxClient,
|
|
39
37
|
// Types
|
package/dist/types/Types.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export declare enum EventEmitterType {
|
|
|
16
16
|
}
|
|
17
17
|
export type SlashCommandOptionChoices = SlashCommandStringOption | SlashCommandNumberOption | SlashCommandIntegerOption;
|
|
18
18
|
export type SlashCommandOption = SlashCommandOptionChoices | SlashCommandBooleanOption | SlashCommandUserOption | SlashCommandChannelOption | SlashCommandRoleOption | SlashCommandMentionableOption;
|
|
19
|
-
export type
|
|
19
|
+
export type SlashArgumentTypes = "String" | "Number" | "Boolean" | "User" | "Channel" | "Role" | "Mentionable" | "Integer";
|
|
20
20
|
declare const _default: {
|
|
21
21
|
CommandType: typeof CommandType;
|
|
22
22
|
EventEmitterType: typeof EventEmitterType;
|
package/dist/utils/ClientUtil.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import XernerxError from "../tools/XernerxError.js";
|
|
1
2
|
export class ClientUtil {
|
|
2
3
|
client;
|
|
3
4
|
constructor(client) {
|
|
@@ -28,7 +29,7 @@ export class ClientUtil {
|
|
|
28
29
|
}
|
|
29
30
|
getSubcommands(name) {
|
|
30
31
|
if (!name || typeof name !== "string")
|
|
31
|
-
throw new
|
|
32
|
+
throw new XernerxError(`Expected name to be of type string, received ${typeof name} instead!`);
|
|
32
33
|
const commands = [];
|
|
33
34
|
this.getAllCommands()
|
|
34
35
|
.filter((c) => (c.data?.name?.toLowerCase() || c.name?.toLowerCase()) ==
|
|
@@ -94,7 +95,7 @@ export class ClientUtil {
|
|
|
94
95
|
}
|
|
95
96
|
isOwner(userId) {
|
|
96
97
|
if (!userId)
|
|
97
|
-
throw new
|
|
98
|
+
throw new XernerxError("No ID specified");
|
|
98
99
|
let owners = this.client.settings.ownerId;
|
|
99
100
|
if (!owners)
|
|
100
101
|
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 {};
|