xernerx 3.3.6 → 3.3.7
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/LICENSE +21 -21
- package/README.md +21 -21
- package/dist/build/ContextCommandBuilder.d.ts +4 -4
- package/dist/build/ContextCommandBuilder.js +4 -4
- package/dist/build/EventBuilder.d.ts +2 -2
- package/dist/build/EventBuilder.js +4 -4
- package/dist/build/InhibitorBuilder.d.ts +3 -3
- package/dist/build/InhibitorBuilder.js +2 -2
- package/dist/build/MessageCommandBuilder.js +1 -1
- package/dist/build/SlashCommandBuilder.d.ts +1 -1
- package/dist/build/SlashCommandBuilder.js +1 -1
- package/dist/main.js +1 -1
- package/dist/models/CommandValidations.d.ts +3 -3
- package/dist/models/CommandValidations.js +26 -28
- package/dist/models/Events.js +8 -6
- package/dist/tools/package.d.ts +38 -0
- package/dist/tools/package.js +41 -0
- package/dist/types/{Types.d.ts → types.d.ts} +0 -0
- package/dist/{interfaces/ClientInterfaces.js → types/types.js} +0 -0
- package/package.json +7 -6
- package/dist/build/ContextCommand.d.ts +0 -40
- package/dist/build/ContextCommand.js +0 -84
- package/dist/build/Event.d.ts +0 -17
- package/dist/build/Event.js +0 -35
- package/dist/build/ExtensionBuilder.d.ts +0 -7
- package/dist/build/ExtensionBuilder.js +0 -9
- package/dist/build/Inhibitor.d.ts +0 -18
- package/dist/build/Inhibitor.js +0 -28
- package/dist/build/MessageCommand.d.ts +0 -41
- package/dist/build/MessageCommand.js +0 -82
- package/dist/build/SlashCommand.d.ts +0 -36
- package/dist/build/SlashCommand.js +0 -125
- package/dist/build/XernerxExtension.d.ts +0 -7
- package/dist/build/XernerxExtension.js +0 -9
- package/dist/handlers/WebhookHandler.d.ts +0 -12
- package/dist/handlers/WebhookHandler.js +0 -36
- package/dist/interfaces/ClientInterfaces.d.ts +0 -65
- package/dist/interfaces/CommandInterfaces.d.ts +0 -94
- package/dist/interfaces/CommandInterfaces.js +0 -1
- package/dist/interfaces/HandlerInterfaces.d.ts +0 -62
- package/dist/interfaces/HandlerInterfaces.js +0 -1
- package/dist/models/Functions.d.ts +0 -1
- package/dist/models/Functions.js +0 -1
- package/dist/types/EventTypes.d.ts +0 -1
- package/dist/types/EventTypes.js +0 -1
- package/dist/types/InhibitorTypes.d.ts +0 -12
- package/dist/types/InhibitorTypes.js +0 -13
- package/dist/types/Types.js +0 -1
- package/dist/types/objects.d.ts +0 -18
- package/dist/types/objects.js +0 -1
- package/scripts/package.d.ts +0 -1
- package/scripts/package.js +0 -3
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { ContextMenuCommandBuilder, } from "discord.js";
|
|
2
|
-
import { s } from "@sapphire/shapeshift";
|
|
3
|
-
import { XernerxClient } from "../main.js";
|
|
4
|
-
/**
|
|
5
|
-
* @description The command builder for context commands.
|
|
6
|
-
* @param {String} id - The unique ID of the command.
|
|
7
|
-
* @param {ContextCommandOptions} options - The command options.
|
|
8
|
-
*/
|
|
9
|
-
export default class ContextCommandBuilder {
|
|
10
|
-
id;
|
|
11
|
-
data;
|
|
12
|
-
description;
|
|
13
|
-
info;
|
|
14
|
-
category;
|
|
15
|
-
owner;
|
|
16
|
-
channelType;
|
|
17
|
-
cooldown;
|
|
18
|
-
ignoreOwner;
|
|
19
|
-
channels;
|
|
20
|
-
guilds;
|
|
21
|
-
userPermissions;
|
|
22
|
-
clientPermissions;
|
|
23
|
-
defer;
|
|
24
|
-
client;
|
|
25
|
-
constructor(id, options) {
|
|
26
|
-
this.id = id;
|
|
27
|
-
this.data = new ContextMenuCommandBuilder();
|
|
28
|
-
if (options.name)
|
|
29
|
-
this.data.setName(options.name);
|
|
30
|
-
if (options.type)
|
|
31
|
-
this.data.setType(options.type);
|
|
32
|
-
if (options.defaultMemberPermissions)
|
|
33
|
-
this.data.setDefaultMemberPermissions(options.defaultMemberPermissions);
|
|
34
|
-
if (options.DMPermission)
|
|
35
|
-
this.data.setDMPermission(options.DMPermission);
|
|
36
|
-
if (options.nameLocalization)
|
|
37
|
-
this.data.setNameLocalization(options.nameLocalization.locale, options.nameLocalization.localizedName);
|
|
38
|
-
if (options.nameLocalizations)
|
|
39
|
-
this.data.setNameLocalizations(options.nameLocalizations);
|
|
40
|
-
s.object({
|
|
41
|
-
description: s.string.optional,
|
|
42
|
-
info: s.string.optional,
|
|
43
|
-
category: s.string.optional,
|
|
44
|
-
owner: s.boolean.optional,
|
|
45
|
-
// channelType?: ChannelType,
|
|
46
|
-
cooldown: s.number.optional,
|
|
47
|
-
ignoreOwner: s.boolean.optional,
|
|
48
|
-
channels: s.array(s.string).optional,
|
|
49
|
-
guilds: s.array(s.string).optional,
|
|
50
|
-
userPermissions: s.array(s.bigint).optional,
|
|
51
|
-
clientPermissions: s.array(s.bigint).optional,
|
|
52
|
-
defer: s.object({
|
|
53
|
-
reply: s.boolean.optional,
|
|
54
|
-
ephemeral: s.boolean.optional,
|
|
55
|
-
fetchReply: s.boolean.optional,
|
|
56
|
-
}).optional,
|
|
57
|
-
}).parse(options);
|
|
58
|
-
this.description = options.description;
|
|
59
|
-
this.info = options.info;
|
|
60
|
-
this.category = options.category;
|
|
61
|
-
this.owner = options.owner;
|
|
62
|
-
this.channelType = options.channelType;
|
|
63
|
-
this.cooldown = options.cooldown;
|
|
64
|
-
this.ignoreOwner = options.ignoreOwner;
|
|
65
|
-
this.channels = options.channels;
|
|
66
|
-
this.guilds = options.guilds;
|
|
67
|
-
this.userPermissions = options.userPermissions;
|
|
68
|
-
this.clientPermissions = options.clientPermissions;
|
|
69
|
-
this.defer = options.defer;
|
|
70
|
-
this.client = XernerxClient;
|
|
71
|
-
this.conditions = this.conditions;
|
|
72
|
-
this.exec = this.exec;
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* @param {Interaction} interaction - The Discord interaction event data.
|
|
76
|
-
* @description make any preconditions here.
|
|
77
|
-
*/
|
|
78
|
-
async conditions(interaction) { }
|
|
79
|
-
/**
|
|
80
|
-
* @param {Interaction} interaction - The Discord interaction event data.
|
|
81
|
-
* @description Make your custom command here.
|
|
82
|
-
*/
|
|
83
|
-
async exec(interaction) { }
|
|
84
|
-
}
|
package/dist/build/Event.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { EventOptions } from "../interfaces/HandlerInterfaces.js";
|
|
2
|
-
import { XernerxClient } from "../main.js";
|
|
3
|
-
/**
|
|
4
|
-
* @description - The event builder for events.
|
|
5
|
-
* @param {String} id - The unique ID of the event.
|
|
6
|
-
* @param {EventOptions} options - The event options.
|
|
7
|
-
*/
|
|
8
|
-
export declare class Event {
|
|
9
|
-
id: string;
|
|
10
|
-
name: string;
|
|
11
|
-
emitter?: string;
|
|
12
|
-
type?: string;
|
|
13
|
-
once?: boolean;
|
|
14
|
-
client: XernerxClient | object;
|
|
15
|
-
constructor(id: string, options: EventOptions);
|
|
16
|
-
run(): Promise<void>;
|
|
17
|
-
}
|
package/dist/build/Event.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { s } from "@sapphire/shapeshift";
|
|
2
|
-
import { XernerxClient } from "../main.js";
|
|
3
|
-
/**
|
|
4
|
-
* @description - The event builder for events.
|
|
5
|
-
* @param {String} id - The unique ID of the event.
|
|
6
|
-
* @param {EventOptions} options - The event options.
|
|
7
|
-
*/
|
|
8
|
-
export class Event {
|
|
9
|
-
id;
|
|
10
|
-
name;
|
|
11
|
-
emitter;
|
|
12
|
-
type;
|
|
13
|
-
once;
|
|
14
|
-
client;
|
|
15
|
-
constructor(id, options) {
|
|
16
|
-
this.id = id;
|
|
17
|
-
s.object({
|
|
18
|
-
name: s.string,
|
|
19
|
-
emitter: s.string.optional,
|
|
20
|
-
type: s.string.optional,
|
|
21
|
-
once: s.boolean.optional,
|
|
22
|
-
}).parse(options);
|
|
23
|
-
this.name = options.name;
|
|
24
|
-
this.emitter = options.emitter || "client";
|
|
25
|
-
this.type = options.type || "discord";
|
|
26
|
-
this.once = options.once || false;
|
|
27
|
-
this.client = XernerxClient;
|
|
28
|
-
this.run = this.run;
|
|
29
|
-
}
|
|
30
|
-
async run() {
|
|
31
|
-
/**
|
|
32
|
-
* @description run your custom event here.
|
|
33
|
-
*/
|
|
34
|
-
}
|
|
35
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { InhibitorOptions } from "../interfaces/HandlerInterfaces.js";
|
|
2
|
-
import { XernerxClient } from "../main.js";
|
|
3
|
-
/**
|
|
4
|
-
* @description - The inhibitor builder for inhibitors.
|
|
5
|
-
* @param {String} id - The unique ID of the inhibitor.
|
|
6
|
-
* @param {InhibitorOptions} options - The inhibitor options.
|
|
7
|
-
*/
|
|
8
|
-
export declare class Inhibitor {
|
|
9
|
-
id: string;
|
|
10
|
-
name: string;
|
|
11
|
-
type: string;
|
|
12
|
-
client: XernerxClient | object;
|
|
13
|
-
constructor(id: string, options: InhibitorOptions);
|
|
14
|
-
/**
|
|
15
|
-
*
|
|
16
|
-
*/
|
|
17
|
-
check(): Promise<void>;
|
|
18
|
-
}
|
package/dist/build/Inhibitor.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { s } from "@sapphire/shapeshift";
|
|
2
|
-
import { XernerxClient } from "../main.js";
|
|
3
|
-
/**
|
|
4
|
-
* @description - The inhibitor builder for inhibitors.
|
|
5
|
-
* @param {String} id - The unique ID of the inhibitor.
|
|
6
|
-
* @param {InhibitorOptions} options - The inhibitor options.
|
|
7
|
-
*/
|
|
8
|
-
export class Inhibitor {
|
|
9
|
-
id;
|
|
10
|
-
name;
|
|
11
|
-
type;
|
|
12
|
-
client;
|
|
13
|
-
constructor(id, options) {
|
|
14
|
-
this.id = id;
|
|
15
|
-
s.object({
|
|
16
|
-
name: s.string,
|
|
17
|
-
type: s.string,
|
|
18
|
-
}).parse(options);
|
|
19
|
-
this.name = options.name;
|
|
20
|
-
this.type = options.type;
|
|
21
|
-
this.client = XernerxClient;
|
|
22
|
-
this.check = this.check;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
*
|
|
26
|
-
*/
|
|
27
|
-
async check() { }
|
|
28
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { MessageCommandOptions } from "../interfaces/CommandInterfaces.js";
|
|
2
|
-
import { Message, ChannelType } from "discord.js";
|
|
3
|
-
import { XernerxClient } from "../main.js";
|
|
4
|
-
/**
|
|
5
|
-
* @description - The command builder for message commands.
|
|
6
|
-
* @param {String} id - The unique ID of the command.
|
|
7
|
-
* @param {MessageCommandOptions} options - The command options.
|
|
8
|
-
*/
|
|
9
|
-
export default class MessageCommandBuilder {
|
|
10
|
-
id: string;
|
|
11
|
-
name: string;
|
|
12
|
-
aliases?: string[];
|
|
13
|
-
description?: string;
|
|
14
|
-
info?: string;
|
|
15
|
-
category?: string;
|
|
16
|
-
prefix?: string | string[];
|
|
17
|
-
owner?: boolean;
|
|
18
|
-
channelType?: ChannelType | ChannelType[];
|
|
19
|
-
separator?: string;
|
|
20
|
-
cooldown?: number;
|
|
21
|
-
ignoreOwner?: boolean;
|
|
22
|
-
channels?: string[];
|
|
23
|
-
guilds?: string[];
|
|
24
|
-
userPermissions?: bigint[];
|
|
25
|
-
clientPermissions?: bigint[];
|
|
26
|
-
args?: object;
|
|
27
|
-
client: XernerxClient | object;
|
|
28
|
-
constructor(id: string, options: MessageCommandOptions);
|
|
29
|
-
/**
|
|
30
|
-
* @param {Message} message - The Discord message event data.
|
|
31
|
-
* @param {object} args - The arguments you created.
|
|
32
|
-
* @description make any preconditions here.
|
|
33
|
-
*/
|
|
34
|
-
conditions(message: Message, args: object): Promise<void>;
|
|
35
|
-
/**
|
|
36
|
-
* @param {Message} message - The Discord message event data.
|
|
37
|
-
* @param {object} args - The arguments you created.
|
|
38
|
-
* @description Make your custom command here.
|
|
39
|
-
*/
|
|
40
|
-
exec(message: Message, args: object): Promise<void>;
|
|
41
|
-
}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { s } from "@sapphire/shapeshift";
|
|
2
|
-
import { XernerxClient } from "../main.js";
|
|
3
|
-
/**
|
|
4
|
-
* @description - The command builder for message commands.
|
|
5
|
-
* @param {String} id - The unique ID of the command.
|
|
6
|
-
* @param {MessageCommandOptions} options - The command options.
|
|
7
|
-
*/
|
|
8
|
-
export default class MessageCommandBuilder {
|
|
9
|
-
id;
|
|
10
|
-
name;
|
|
11
|
-
aliases;
|
|
12
|
-
description;
|
|
13
|
-
info;
|
|
14
|
-
category;
|
|
15
|
-
prefix;
|
|
16
|
-
owner;
|
|
17
|
-
channelType;
|
|
18
|
-
separator;
|
|
19
|
-
cooldown;
|
|
20
|
-
ignoreOwner;
|
|
21
|
-
channels;
|
|
22
|
-
guilds;
|
|
23
|
-
userPermissions;
|
|
24
|
-
clientPermissions;
|
|
25
|
-
args;
|
|
26
|
-
client;
|
|
27
|
-
constructor(id, options) {
|
|
28
|
-
this.id = id;
|
|
29
|
-
s.object({
|
|
30
|
-
name: s.string,
|
|
31
|
-
aliases: s.union(s.array(s.string).unique, s.string).optional,
|
|
32
|
-
description: s.string.optional,
|
|
33
|
-
info: s.string.optional,
|
|
34
|
-
category: s.string.optional,
|
|
35
|
-
prefix: s.union(s.array(s.string).unique, s.string).optional,
|
|
36
|
-
owner: s.boolean.optional,
|
|
37
|
-
// channelType: s.union(s.enum(ChannelType),s.array(s.enum(ChannelType)).unique).optional,
|
|
38
|
-
separator: s.string.optional,
|
|
39
|
-
cooldown: s.number.optional,
|
|
40
|
-
ignoreOwner: s.boolean.optional,
|
|
41
|
-
channels: s.array(s.string).unique.optional,
|
|
42
|
-
guilds: s.array(s.string).unique.optional,
|
|
43
|
-
userPermissions: s.array(s.bigint).unique.optional,
|
|
44
|
-
clientPermissions: s.array(s.bigint).unique.optional,
|
|
45
|
-
}).parse(options);
|
|
46
|
-
this.name = options.name;
|
|
47
|
-
this.aliases = options.aliases;
|
|
48
|
-
this.description = options.description;
|
|
49
|
-
this.info = options.info;
|
|
50
|
-
this.category = options.category;
|
|
51
|
-
this.prefix = options.prefix
|
|
52
|
-
? Array.isArray(options.prefix)
|
|
53
|
-
? options.prefix
|
|
54
|
-
: [options.prefix]
|
|
55
|
-
: [];
|
|
56
|
-
this.owner = options.owner || false;
|
|
57
|
-
this.channelType = options.channelType;
|
|
58
|
-
this.separator = options.separator || " ";
|
|
59
|
-
this.cooldown = options.cooldown || 0;
|
|
60
|
-
this.ignoreOwner = options.ignoreOwner || false;
|
|
61
|
-
this.channels = options.channels || [];
|
|
62
|
-
this.guilds = options.guilds || [];
|
|
63
|
-
this.userPermissions = options.userPermissions || [];
|
|
64
|
-
this.clientPermissions = options.clientPermissions || [];
|
|
65
|
-
this.args = options.args;
|
|
66
|
-
this.client = XernerxClient;
|
|
67
|
-
this.conditions = this.conditions;
|
|
68
|
-
this.exec = this.exec;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* @param {Message} message - The Discord message event data.
|
|
72
|
-
* @param {object} args - The arguments you created.
|
|
73
|
-
* @description make any preconditions here.
|
|
74
|
-
*/
|
|
75
|
-
async conditions(message, args) { }
|
|
76
|
-
/**
|
|
77
|
-
* @param {Message} message - The Discord message event data.
|
|
78
|
-
* @param {object} args - The arguments you created.
|
|
79
|
-
* @description Make your custom command here.
|
|
80
|
-
*/
|
|
81
|
-
async exec(message, args) { }
|
|
82
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { SlashCommandOptions } from "../interfaces/CommandInterfaces.js";
|
|
2
|
-
import Discord, { ChannelType, Interaction } from "discord.js";
|
|
3
|
-
import { XernerxClient } from "../main.js";
|
|
4
|
-
/**
|
|
5
|
-
* @description - The command builder for slash commands.
|
|
6
|
-
* @param {String} id - The unique ID of the command.
|
|
7
|
-
* @param {SlashCommandOptions} options - The command options.
|
|
8
|
-
*/
|
|
9
|
-
export default class SlashCommandBuilder {
|
|
10
|
-
#private;
|
|
11
|
-
id: string;
|
|
12
|
-
data: Discord.SlashCommandBuilder;
|
|
13
|
-
info?: string;
|
|
14
|
-
category?: string;
|
|
15
|
-
owner?: boolean;
|
|
16
|
-
channelType?: ChannelType;
|
|
17
|
-
separator?: string;
|
|
18
|
-
cooldown?: number;
|
|
19
|
-
ignoreOwner?: boolean;
|
|
20
|
-
channels?: string[];
|
|
21
|
-
guilds?: string[];
|
|
22
|
-
userPermissions?: bigint[];
|
|
23
|
-
clientPermissions?: bigint[];
|
|
24
|
-
args?: object[];
|
|
25
|
-
subcommands?: object[];
|
|
26
|
-
groups?: object[];
|
|
27
|
-
defer?: {
|
|
28
|
-
reply?: boolean;
|
|
29
|
-
ephemeral?: boolean;
|
|
30
|
-
fetchReply?: boolean;
|
|
31
|
-
};
|
|
32
|
-
client: XernerxClient | object;
|
|
33
|
-
constructor(id: string, options: SlashCommandOptions);
|
|
34
|
-
conditions(interaction: Interaction): Promise<void>;
|
|
35
|
-
exec(interaction: Interaction): Promise<void>;
|
|
36
|
-
}
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
import Discord, { SlashCommandSubcommandBuilder, SlashCommandSubcommandGroupBuilder, } from "discord.js";
|
|
2
|
-
import { s } from "@sapphire/shapeshift";
|
|
3
|
-
import { XernerxClient } from "../main.js";
|
|
4
|
-
import XernerxError from "../tools/XernerxError.js";
|
|
5
|
-
/**
|
|
6
|
-
* @description - The command builder for slash commands.
|
|
7
|
-
* @param {String} id - The unique ID of the command.
|
|
8
|
-
* @param {SlashCommandOptions} options - The command options.
|
|
9
|
-
*/
|
|
10
|
-
export default class SlashCommandBuilder {
|
|
11
|
-
id;
|
|
12
|
-
data;
|
|
13
|
-
info;
|
|
14
|
-
category;
|
|
15
|
-
owner;
|
|
16
|
-
channelType;
|
|
17
|
-
separator;
|
|
18
|
-
cooldown;
|
|
19
|
-
ignoreOwner;
|
|
20
|
-
channels;
|
|
21
|
-
guilds;
|
|
22
|
-
userPermissions;
|
|
23
|
-
clientPermissions;
|
|
24
|
-
args;
|
|
25
|
-
subcommands;
|
|
26
|
-
groups;
|
|
27
|
-
defer;
|
|
28
|
-
client;
|
|
29
|
-
constructor(id, options) {
|
|
30
|
-
this.id = id;
|
|
31
|
-
this.data = new Discord.SlashCommandBuilder()
|
|
32
|
-
.setName(options.name)
|
|
33
|
-
.setDescription(options.description);
|
|
34
|
-
if (options.args && options?.args?.length > 0) {
|
|
35
|
-
this.#addArgs(this.data, options.args);
|
|
36
|
-
}
|
|
37
|
-
if (options.subcommands && options?.subcommands?.length > 0) {
|
|
38
|
-
this.#addSubcommands(this.data, options.subcommands);
|
|
39
|
-
}
|
|
40
|
-
if (options.groups && options?.groups?.length > 0) {
|
|
41
|
-
this.#addSubcommandGroups(options.groups);
|
|
42
|
-
}
|
|
43
|
-
s.object({
|
|
44
|
-
info: s.string.optional,
|
|
45
|
-
category: s.string.optional,
|
|
46
|
-
owner: s.boolean.optional,
|
|
47
|
-
// channelType: s.ChannelType.optional,
|
|
48
|
-
separator: s.string.optional,
|
|
49
|
-
cooldown: s.number.optional,
|
|
50
|
-
ignoreOwner: s.boolean.optional,
|
|
51
|
-
channels: s.array(s.string).optional,
|
|
52
|
-
guilds: s.array(s.string).optional,
|
|
53
|
-
userPermissions: s.array(s.bigint).optional,
|
|
54
|
-
clientPermissions: s.array(s.bigint).optional,
|
|
55
|
-
defer: s.object({
|
|
56
|
-
reply: s.boolean.optional,
|
|
57
|
-
ephemeral: s.boolean.optional,
|
|
58
|
-
fetchReply: s.boolean.optional,
|
|
59
|
-
}).optional,
|
|
60
|
-
});
|
|
61
|
-
this.info = options.info;
|
|
62
|
-
this.category = options.category;
|
|
63
|
-
this.owner = options.owner;
|
|
64
|
-
this.channelType = options.channelType;
|
|
65
|
-
this.separator = options.separator;
|
|
66
|
-
this.cooldown = options.cooldown;
|
|
67
|
-
this.ignoreOwner = options.ignoreOwner;
|
|
68
|
-
this.channels = options.channels;
|
|
69
|
-
this.guilds = options.guilds;
|
|
70
|
-
this.userPermissions = options.userPermissions;
|
|
71
|
-
this.clientPermissions = options.clientPermissions;
|
|
72
|
-
this.defer = options.defer;
|
|
73
|
-
this.client = XernerxClient;
|
|
74
|
-
this.conditions = this.conditions;
|
|
75
|
-
this.exec = this.exec;
|
|
76
|
-
}
|
|
77
|
-
async conditions(interaction) { }
|
|
78
|
-
async exec(interaction) { }
|
|
79
|
-
#addArgs(command, args) {
|
|
80
|
-
const types = [
|
|
81
|
-
"boolean",
|
|
82
|
-
"integer",
|
|
83
|
-
"number",
|
|
84
|
-
"string",
|
|
85
|
-
"user",
|
|
86
|
-
"role",
|
|
87
|
-
"channel",
|
|
88
|
-
"mentionable",
|
|
89
|
-
];
|
|
90
|
-
for (const argument of args) {
|
|
91
|
-
if (!types.includes(argument.type.toLowerCase()))
|
|
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
|
-
option
|
|
96
|
-
.setName(argument.name)
|
|
97
|
-
.setDescription(argument.description)
|
|
98
|
-
.setRequired(argument.required || false);
|
|
99
|
-
if (argument.choices)
|
|
100
|
-
option.setChoices(...argument?.choices);
|
|
101
|
-
return option;
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
#addSubcommands(method, subcommands) {
|
|
106
|
-
for (const subcommand of subcommands) {
|
|
107
|
-
let sub = new SlashCommandSubcommandBuilder()
|
|
108
|
-
.setName(subcommand.name)
|
|
109
|
-
.setDescription(subcommand.description);
|
|
110
|
-
if (subcommand.args?.length > 0)
|
|
111
|
-
this.#addArgs(sub, subcommand.args);
|
|
112
|
-
method.addSubcommand(sub);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
#addSubcommandGroups(groups) {
|
|
116
|
-
for (const group of groups) {
|
|
117
|
-
let subcommandGroup = new SlashCommandSubcommandGroupBuilder()
|
|
118
|
-
.setName(group.name)
|
|
119
|
-
.setDescription(group.description);
|
|
120
|
-
if (group.subcommands?.length > 0)
|
|
121
|
-
this.#addSubcommands(subcommandGroup, group.subcommands);
|
|
122
|
-
this.data.addSubcommandGroup(subcommandGroup);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { XernerxClient } from "../main.js";
|
|
2
|
-
interface WebhookOptions {
|
|
3
|
-
token: string;
|
|
4
|
-
logging: boolean;
|
|
5
|
-
}
|
|
6
|
-
export default class WebhookHandler {
|
|
7
|
-
client: XernerxClient;
|
|
8
|
-
constructor(client: XernerxClient);
|
|
9
|
-
post(options: WebhookOptions): import("topgg-autoposter/dist/structs/BasePoster.js").BasePoster;
|
|
10
|
-
vote(options: WebhookOptions): void;
|
|
11
|
-
}
|
|
12
|
-
export {};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
import { AutoPoster } from 'topgg-autoposter';
|
|
3
|
-
import SDK from '@top-gg/sdk';
|
|
4
|
-
import { Style } from 'dumfunctions';
|
|
5
|
-
import express from 'express';
|
|
6
|
-
export default class WebhookHandler {
|
|
7
|
-
client;
|
|
8
|
-
constructor(client) {
|
|
9
|
-
this.client = client;
|
|
10
|
-
this.vote = this.vote;
|
|
11
|
-
this.post = this.post;
|
|
12
|
-
}
|
|
13
|
-
post(options) {
|
|
14
|
-
const auto = AutoPoster(options.token, this.client);
|
|
15
|
-
auto
|
|
16
|
-
.on('posted', post => {
|
|
17
|
-
if (options.logging)
|
|
18
|
-
console.info(Style.log(`Xernerx | Successfully posted bot stats to Top.gg!`, { color: Style.TextColor.Cyan }));
|
|
19
|
-
return this.client.emit('webhookPost', post);
|
|
20
|
-
})
|
|
21
|
-
.on('error', error => {
|
|
22
|
-
if (options.logging)
|
|
23
|
-
console.info(Style.log(`Xernerx | An error occurred while posting stats to Top.gg, ${error}.`, { color: Style.BackgroundColor.Red }));
|
|
24
|
-
return this.client.emit('webhookError', error);
|
|
25
|
-
});
|
|
26
|
-
return auto;
|
|
27
|
-
}
|
|
28
|
-
vote(options) {
|
|
29
|
-
const app = express();
|
|
30
|
-
const webhook = new SDK.Webhook(options.token);
|
|
31
|
-
app.post("/dblwebhook", webhook.listener(vote => {
|
|
32
|
-
console.log(vote);
|
|
33
|
-
}));
|
|
34
|
-
app.listen(80);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { CacheFactory, Collection, MessageMentionOptions, Partials, PresenceData, RESTOptions, SweeperOptions, WebSocketOptions } from "discord.js";
|
|
2
|
-
import CommandHandler from "../handlers/CommandHandler.js";
|
|
3
|
-
import EventHandler from "../handlers/EventHandler.js";
|
|
4
|
-
import InhibitorHandler from "../handlers/InhibitorHandler.js";
|
|
5
|
-
import { ContextCommandOptions, MessageCommandOptions, SlashCommandOptions, EventLoadOptions, InhibitorLoadOptions } from "./HandlerInterfaces.js";
|
|
6
|
-
import MessageCommandBuilder from "../build/MessageCommandBuilder.js";
|
|
7
|
-
import ContextCommandBuilder from "../build/ContextCommandBuilder.js";
|
|
8
|
-
import SlashCommandBuilder from "../build/SlashCommandBuilder.js";
|
|
9
|
-
import ExtensionBuilder from "../build/ExtensionBuilder.js";
|
|
10
|
-
export interface DiscordOptions {
|
|
11
|
-
shards?: number | number[] | "auto";
|
|
12
|
-
closeTimeout?: number;
|
|
13
|
-
shardCount?: number;
|
|
14
|
-
makeCache?: CacheFactory;
|
|
15
|
-
allowedMentions?: MessageMentionOptions;
|
|
16
|
-
partials?: Array<Partials>;
|
|
17
|
-
failIfNotExists?: boolean;
|
|
18
|
-
presence?: PresenceData;
|
|
19
|
-
intents: number[];
|
|
20
|
-
waitGuildTimeout?: number;
|
|
21
|
-
sweepers?: SweeperOptions;
|
|
22
|
-
ws?: WebSocketOptions;
|
|
23
|
-
rest?: RESTOptions;
|
|
24
|
-
jsonTransformer?: (obj: unknown) => unknown;
|
|
25
|
-
}
|
|
26
|
-
export interface ClientOptions {
|
|
27
|
-
ownerId?: string | string[];
|
|
28
|
-
clientPermissions?: bigint[];
|
|
29
|
-
userPermissions?: bigint[];
|
|
30
|
-
ignoreOwner?: boolean;
|
|
31
|
-
logging?: boolean;
|
|
32
|
-
cooldown?: {
|
|
33
|
-
default?: number;
|
|
34
|
-
cache?: number;
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
export interface HandlerOptions {
|
|
38
|
-
message?: MessageCommandOptions;
|
|
39
|
-
slash?: SlashCommandOptions;
|
|
40
|
-
context?: ContextCommandOptions;
|
|
41
|
-
events?: EventLoadOptions;
|
|
42
|
-
inhibitors?: InhibitorLoadOptions;
|
|
43
|
-
}
|
|
44
|
-
export interface Commands {
|
|
45
|
-
message: Collection<string, MessageCommandBuilder>;
|
|
46
|
-
slash: Collection<string, SlashCommandBuilder>;
|
|
47
|
-
context: Collection<string, ContextCommandBuilder>;
|
|
48
|
-
}
|
|
49
|
-
export interface Cache {
|
|
50
|
-
messages: Collection<string, object>;
|
|
51
|
-
cooldowns: Collection<string, object>;
|
|
52
|
-
messageCommands: Collection<string, object>;
|
|
53
|
-
slashCommands: Collection<string, object>;
|
|
54
|
-
contextCommands: Collection<string, object>;
|
|
55
|
-
commands: Collection<string, object>;
|
|
56
|
-
}
|
|
57
|
-
export interface Modules {
|
|
58
|
-
commandHandler: CommandHandler;
|
|
59
|
-
eventHandler: EventHandler;
|
|
60
|
-
inhibitorHandler: InhibitorHandler;
|
|
61
|
-
}
|
|
62
|
-
export interface ExtensionOptions {
|
|
63
|
-
extensions: Array<ExtensionBuilder>;
|
|
64
|
-
logging?: boolean;
|
|
65
|
-
}
|