reciple 5.4.0-pre.2 → 5.4.0
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/bin/reciple/classes/RecipleClient.d.ts +1 -1
- package/bin/reciple/classes/RecipleClient.js +3 -3
- package/bin/reciple/classes/builders/MessageCommandBuilder.js +2 -3
- package/bin/reciple/classes/builders/SlashCommandBuilder.js +15 -16
- package/bin/reciple/modules.js +2 -2
- package/bin/reciple/types/builders.d.ts +29 -33
- package/bin/reciple/util.js +4 -4
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MessageCommandBuilder, MessageCommandExecuteData, MessageCommandHaltData } from './builders/MessageCommandBuilder';
|
|
2
2
|
import { SlashCommandBuilder, SlashCommandExecuteData, SlashCommandHaltData } from './builders/SlashCommandBuilder';
|
|
3
|
-
import { ApplicationCommandBuilder } from '../registerApplicationCommands';
|
|
4
3
|
import { AnyCommandBuilder, AnyCommandData, AnySlashCommandBuilder, CommandBuilderType } from '../types/builders';
|
|
4
|
+
import { ApplicationCommandBuilder } from '../registerApplicationCommands';
|
|
5
5
|
import { AnyCommandExecuteData, AnyCommandHaltData } from '../types/commands';
|
|
6
6
|
import { CommandCooldownManager } from './CommandCooldownManager';
|
|
7
7
|
import { RecipleClientAddModuleOptions } from '../types/paramOptions';
|
|
@@ -15,8 +15,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
15
15
|
exports.RecipleClient = void 0;
|
|
16
16
|
const MessageCommandBuilder_1 = require("./builders/MessageCommandBuilder");
|
|
17
17
|
const SlashCommandBuilder_1 = require("./builders/SlashCommandBuilder");
|
|
18
|
-
const registerApplicationCommands_1 = require("../registerApplicationCommands");
|
|
19
18
|
const builders_1 = require("../types/builders");
|
|
19
|
+
const registerApplicationCommands_1 = require("../registerApplicationCommands");
|
|
20
20
|
const commands_1 = require("../types/commands");
|
|
21
21
|
const permissions_1 = require("../permissions");
|
|
22
22
|
const CommandCooldownManager_1 = require("./CommandCooldownManager");
|
|
@@ -26,9 +26,9 @@ const RecipleConfig_1 = require("./RecipleConfig");
|
|
|
26
26
|
const modules_1 = require("../modules");
|
|
27
27
|
const logger_1 = require("../logger");
|
|
28
28
|
const version_1 = require("../version");
|
|
29
|
-
const discord_js_1 = require("discord.js");
|
|
30
|
-
const path_1 = __importDefault(require("path"));
|
|
31
29
|
const flags_1 = require("../flags");
|
|
30
|
+
const path_1 = __importDefault(require("path"));
|
|
31
|
+
const discord_js_1 = require("discord.js");
|
|
32
32
|
class RecipleClient extends discord_js_1.Client {
|
|
33
33
|
/**
|
|
34
34
|
* @param options Client options
|
|
@@ -14,7 +14,6 @@ const builders_1 = require("../../types/builders");
|
|
|
14
14
|
const discord_js_1 = require("discord.js");
|
|
15
15
|
const MessageCommandOptionManager_1 = require("../MessageCommandOptionManager");
|
|
16
16
|
const MessageCommandOptionBuilder_1 = require("./MessageCommandOptionBuilder");
|
|
17
|
-
const fallout_utility_1 = require("fallout-utility");
|
|
18
17
|
/**
|
|
19
18
|
* Reciple builder for message command
|
|
20
19
|
*/
|
|
@@ -36,8 +35,8 @@ class MessageCommandBuilder {
|
|
|
36
35
|
this.setName(data.name);
|
|
37
36
|
if ((data === null || data === void 0 ? void 0 : data.description) !== undefined)
|
|
38
37
|
this.setDescription(data.description);
|
|
39
|
-
if ((
|
|
40
|
-
this.setCooldown(data === null || data === void 0 ? void 0 : data.cooldown);
|
|
38
|
+
if ((data === null || data === void 0 ? void 0 : data.cooldown) !== undefined)
|
|
39
|
+
this.setCooldown(Number(data === null || data === void 0 ? void 0 : data.cooldown));
|
|
41
40
|
if ((data === null || data === void 0 ? void 0 : data.requiredBotPermissions) !== undefined)
|
|
42
41
|
this.setRequiredBotPermissions(data.requiredBotPermissions);
|
|
43
42
|
if ((data === null || data === void 0 ? void 0 : data.requiredMemberPermissions) !== undefined)
|
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SlashCommandBuilder = void 0;
|
|
4
4
|
const builders_1 = require("../../types/builders");
|
|
5
|
-
const discord_js_1 = require("discord.js");
|
|
6
|
-
const fallout_utility_1 = require("fallout-utility");
|
|
7
5
|
const util_1 = require("../../util");
|
|
6
|
+
const discord_js_1 = require("discord.js");
|
|
8
7
|
/**
|
|
9
8
|
* Reciple builder for slash command
|
|
10
9
|
*/
|
|
@@ -20,8 +19,8 @@ class SlashCommandBuilder extends discord_js_1.SlashCommandBuilder {
|
|
|
20
19
|
this.setName(data.name);
|
|
21
20
|
if ((data === null || data === void 0 ? void 0 : data.description) !== undefined)
|
|
22
21
|
this.setDescription(data.description);
|
|
23
|
-
if ((
|
|
24
|
-
this.setCooldown(data === null || data === void 0 ? void 0 : data.cooldown);
|
|
22
|
+
if ((data === null || data === void 0 ? void 0 : data.cooldown) !== undefined)
|
|
23
|
+
this.setCooldown(Number(data === null || data === void 0 ? void 0 : data.cooldown));
|
|
25
24
|
if ((data === null || data === void 0 ? void 0 : data.requiredBotPermissions) !== undefined)
|
|
26
25
|
this.setRequiredBotPermissions(data.requiredBotPermissions);
|
|
27
26
|
if ((data === null || data === void 0 ? void 0 : data.requiredMemberPermissions) !== undefined)
|
|
@@ -72,14 +71,8 @@ class SlashCommandBuilder extends discord_js_1.SlashCommandBuilder {
|
|
|
72
71
|
* Add option builder to command builder
|
|
73
72
|
*/
|
|
74
73
|
static addOption(builder, option) {
|
|
75
|
-
if (option instanceof discord_js_1.
|
|
76
|
-
builder.
|
|
77
|
-
}
|
|
78
|
-
else if (option instanceof discord_js_1.SlashCommandNumberOption) {
|
|
79
|
-
builder.addNumberOption(option);
|
|
80
|
-
}
|
|
81
|
-
else if (option instanceof discord_js_1.SlashCommandIntegerOption) {
|
|
82
|
-
builder.addIntegerOption(option);
|
|
74
|
+
if (option instanceof discord_js_1.SlashCommandAttachmentOption) {
|
|
75
|
+
builder.addAttachmentOption(option);
|
|
83
76
|
}
|
|
84
77
|
else if (option instanceof discord_js_1.SlashCommandBooleanOption) {
|
|
85
78
|
builder.addBooleanOption(option);
|
|
@@ -87,17 +80,23 @@ class SlashCommandBuilder extends discord_js_1.SlashCommandBuilder {
|
|
|
87
80
|
else if (option instanceof discord_js_1.SlashCommandChannelOption) {
|
|
88
81
|
builder.addChannelOption(option);
|
|
89
82
|
}
|
|
83
|
+
else if (option instanceof discord_js_1.SlashCommandIntegerOption) {
|
|
84
|
+
builder.addIntegerOption(option);
|
|
85
|
+
}
|
|
90
86
|
else if (option instanceof discord_js_1.SlashCommandMentionableOption) {
|
|
91
87
|
builder.addMentionableOption(option);
|
|
92
88
|
}
|
|
93
|
-
else if (option instanceof discord_js_1.
|
|
94
|
-
builder.
|
|
89
|
+
else if (option instanceof discord_js_1.SlashCommandNumberOption) {
|
|
90
|
+
builder.addNumberOption(option);
|
|
95
91
|
}
|
|
96
92
|
else if (option instanceof discord_js_1.SlashCommandRoleOption) {
|
|
97
93
|
builder.addRoleOption(option);
|
|
98
94
|
}
|
|
99
|
-
else if (option instanceof discord_js_1.
|
|
100
|
-
builder.
|
|
95
|
+
else if (option instanceof discord_js_1.SlashCommandStringOption) {
|
|
96
|
+
builder.addStringOption(option);
|
|
97
|
+
}
|
|
98
|
+
else if (option instanceof discord_js_1.SlashCommandUserOption) {
|
|
99
|
+
builder.addUserOption(option);
|
|
101
100
|
}
|
|
102
101
|
else if (builder instanceof SlashCommandBuilder) {
|
|
103
102
|
if (option instanceof discord_js_1.SlashCommandSubcommandBuilder) {
|
package/bin/reciple/modules.js
CHANGED
|
@@ -14,14 +14,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.getModules = void 0;
|
|
16
16
|
const builders_1 = require("./types/builders");
|
|
17
|
+
const MessageCommandBuilder_1 = require("./classes/builders/MessageCommandBuilder");
|
|
18
|
+
const SlashCommandBuilder_1 = require("./classes/builders/SlashCommandBuilder");
|
|
17
19
|
const discord_js_1 = require("discord.js");
|
|
18
20
|
const version_1 = require("./version");
|
|
19
21
|
const fs_1 = require("fs");
|
|
20
22
|
const wildcard_match_1 = __importDefault(require("wildcard-match"));
|
|
21
23
|
const flags_1 = require("./flags");
|
|
22
24
|
const path_1 = __importDefault(require("path"));
|
|
23
|
-
const MessageCommandBuilder_1 = require("./classes/builders/MessageCommandBuilder");
|
|
24
|
-
const SlashCommandBuilder_1 = require("./classes/builders/SlashCommandBuilder");
|
|
25
25
|
/**
|
|
26
26
|
* Load modules from folder
|
|
27
27
|
* @param client Reciple client
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { MessageCommandBuilder, MessageCommandExecuteData, MessageCommandExecuteFunction, MessageCommandHaltData, MessageCommandHaltFunction } from '../classes/builders/MessageCommandBuilder';
|
|
2
|
-
import { SlashCommandBuilder, SlashCommandExecuteData, SlashCommandExecuteFunction, SlashCommandHaltData, SlashCommandHaltFunction, SlashCommandOptionsOnlyBuilder, SlashCommandSubcommandsOnlyBuilder } from '../classes/builders/SlashCommandBuilder';
|
|
3
1
|
import { ApplicationCommandOptionAllowedChannelTypes, ApplicationCommandOptionType, Awaitable, LocalizationMap, PermissionResolvable, RestOrArray, SlashCommandAttachmentOption, SlashCommandBooleanOption, SlashCommandChannelOption, SlashCommandIntegerOption, SlashCommandMentionableOption, SlashCommandNumberOption, SlashCommandRoleOption, SlashCommandStringOption, SlashCommandSubcommandBuilder, SlashCommandSubcommandGroupBuilder, SlashCommandUserOption } from 'discord.js';
|
|
2
|
+
import { SlashCommandBuilder, SlashCommandExecuteData, SlashCommandExecuteFunction, SlashCommandHaltData, SlashCommandHaltFunction, SlashCommandOptionsOnlyBuilder, SlashCommandSubcommandsOnlyBuilder } from '../classes/builders/SlashCommandBuilder';
|
|
3
|
+
import { MessageCommandBuilder, MessageCommandExecuteData, MessageCommandExecuteFunction, MessageCommandHaltData, MessageCommandHaltFunction } from '../classes/builders/MessageCommandBuilder';
|
|
4
4
|
import { MessageCommandOptionBuilder } from '../classes/builders/MessageCommandOptionBuilder';
|
|
5
5
|
/**
|
|
6
6
|
* Any command builders
|
|
@@ -119,66 +119,59 @@ export interface SlashCommandData extends SharedCommandDataProperties, Partial<O
|
|
|
119
119
|
execute: SlashCommandExecuteFunction;
|
|
120
120
|
}
|
|
121
121
|
export interface SharedSlashCommandOptionData<V = string | number> extends SharedCommandDataProperties, Pick<SlashCommandData, "nameLocalizations" | "descriptionLocalizations"> {
|
|
122
|
-
/**
|
|
123
|
-
* Option choices
|
|
124
|
-
*/
|
|
125
122
|
choices?: {
|
|
126
123
|
name: string;
|
|
127
124
|
nameLocalizations?: LocalizationMap;
|
|
128
125
|
value: V;
|
|
129
126
|
}[];
|
|
130
|
-
/**
|
|
131
|
-
* Enable autocomplete
|
|
132
|
-
*/
|
|
133
127
|
autocomplete?: boolean;
|
|
134
|
-
/**
|
|
135
|
-
* Is required
|
|
136
|
-
* @default false
|
|
137
|
-
*/
|
|
138
128
|
required?: boolean;
|
|
139
129
|
}
|
|
140
|
-
export interface
|
|
141
|
-
type: ApplicationCommandOptionType.
|
|
142
|
-
minLength?: number;
|
|
143
|
-
maxLength?: number;
|
|
130
|
+
export interface SlashCommandAttachmentOptionData extends Omit<SharedSlashCommandOptionData, "choices" | "autocomplete"> {
|
|
131
|
+
type: ApplicationCommandOptionType.Attachment;
|
|
144
132
|
}
|
|
145
|
-
export interface
|
|
146
|
-
type: ApplicationCommandOptionType.
|
|
147
|
-
|
|
148
|
-
|
|
133
|
+
export interface SlashCommandBooleanOptionData extends Omit<SharedSlashCommandOptionData, "choices" | "autocomplete"> {
|
|
134
|
+
type: ApplicationCommandOptionType.Boolean;
|
|
135
|
+
}
|
|
136
|
+
export interface SlashCommandChannelOptionData extends Omit<SharedSlashCommandOptionData, "choices" | "autocomplete"> {
|
|
137
|
+
type: ApplicationCommandOptionType.Channel;
|
|
138
|
+
channelTypes?: ApplicationCommandOptionAllowedChannelTypes[];
|
|
149
139
|
}
|
|
150
140
|
export interface SlashCommandIntegerOptionData extends SharedSlashCommandOptionData<number> {
|
|
151
141
|
type: ApplicationCommandOptionType.Integer;
|
|
152
142
|
minValue?: number;
|
|
153
143
|
maxValue?: number;
|
|
154
144
|
}
|
|
155
|
-
export interface SlashCommandBooleanOptionData extends Omit<SharedSlashCommandOptionData, "choices" | "autocomplete"> {
|
|
156
|
-
type: ApplicationCommandOptionType.Boolean;
|
|
157
|
-
}
|
|
158
145
|
export interface SlashCommandMentionableOptionData extends Omit<SharedSlashCommandOptionData, "choices" | "autocomplete"> {
|
|
159
146
|
type: ApplicationCommandOptionType.Mentionable;
|
|
160
147
|
}
|
|
148
|
+
export interface SlashCommandNumberOptionData extends SharedSlashCommandOptionData<number> {
|
|
149
|
+
type: ApplicationCommandOptionType.Number;
|
|
150
|
+
minValue?: number;
|
|
151
|
+
maxValue?: number;
|
|
152
|
+
}
|
|
161
153
|
export interface SlashCommandRoleOptionData extends Omit<SharedSlashCommandOptionData, "choices" | "autocomplete"> {
|
|
162
154
|
type: ApplicationCommandOptionType.Role;
|
|
163
155
|
}
|
|
156
|
+
export interface SlashCommandStringOptionData extends SharedSlashCommandOptionData<string> {
|
|
157
|
+
type: ApplicationCommandOptionType.String;
|
|
158
|
+
minLength?: number;
|
|
159
|
+
maxLength?: number;
|
|
160
|
+
}
|
|
164
161
|
export interface SlashCommandUserOptionData extends Omit<SharedSlashCommandOptionData, "choices" | "autocomplete"> {
|
|
165
162
|
type: ApplicationCommandOptionType.User;
|
|
166
163
|
}
|
|
167
|
-
export interface
|
|
168
|
-
type: ApplicationCommandOptionType.
|
|
169
|
-
|
|
170
|
-
export interface SlashCommandChannelOptionData extends Omit<SharedSlashCommandOptionData, "choices" | "autocomplete"> {
|
|
171
|
-
type: ApplicationCommandOptionType.Channel;
|
|
172
|
-
channelTypes?: ApplicationCommandOptionAllowedChannelTypes[];
|
|
164
|
+
export interface SlashCommandSubCommandData extends SharedCommandDataProperties, Pick<SlashCommandData, "nameLocalizations" | "descriptionLocalizations"> {
|
|
165
|
+
type: ApplicationCommandOptionType.Subcommand;
|
|
166
|
+
options: (AnySlashCommandOptionsOnlyOptionData | AnySlashCommandOptionsOnlyOptionBuilder)[];
|
|
173
167
|
}
|
|
174
168
|
export interface SlashCommandSubCommandGroupData extends SharedCommandDataProperties, Pick<SlashCommandData, "nameLocalizations" | "descriptionLocalizations"> {
|
|
175
169
|
type: ApplicationCommandOptionType.SubcommandGroup;
|
|
176
170
|
options: (SlashCommandSubCommandData | SlashCommandSubcommandBuilder)[];
|
|
177
171
|
}
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
}
|
|
172
|
+
/**
|
|
173
|
+
* Message command object data interface
|
|
174
|
+
*/
|
|
182
175
|
export interface MessageCommandData extends SharedCommandDataProperties, Partial<Omit<SharedCommandBuilderProperties, "setCooldown" | "setRequiredBotPermissions" | "setRequiredMemberPermissions" | "setHalt" | "setExecute" | "halt" | "execute">> {
|
|
183
176
|
type: CommandBuilderType.MessageCommand;
|
|
184
177
|
aliases?: string[];
|
|
@@ -189,6 +182,9 @@ export interface MessageCommandData extends SharedCommandDataProperties, Partial
|
|
|
189
182
|
execute: MessageCommandExecuteFunction;
|
|
190
183
|
options: MessageCommandOptionResolvable[];
|
|
191
184
|
}
|
|
185
|
+
/**
|
|
186
|
+
* Message command option object data interface
|
|
187
|
+
*/
|
|
192
188
|
export interface MessageCommandOptionData extends SharedCommandDataProperties {
|
|
193
189
|
name: string;
|
|
194
190
|
description: string;
|
package/bin/reciple/util.js
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isClass = void 0;
|
|
4
4
|
function isClass(object) {
|
|
5
|
-
const
|
|
5
|
+
const isClassConstructor = object.constructor && object.constructor.toString().substring(0, 5) === 'class';
|
|
6
6
|
if (object.prototype === undefined)
|
|
7
|
-
return
|
|
8
|
-
const
|
|
9
|
-
return
|
|
7
|
+
return isClassConstructor;
|
|
8
|
+
const isPrototypeClassConstructor = object.prototype.constructor && object.prototype.constructor.toString && object.prototype.constructor.toString().substring(0, 5) === 'class';
|
|
9
|
+
return isClassConstructor || isPrototypeClassConstructor;
|
|
10
10
|
}
|
|
11
11
|
exports.isClass = isClass;
|