reciple 3.0.0 → 3.0.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/README.md +9 -3
- package/bin/bin.js +3 -3
- package/bin/index.d.ts +2 -1
- package/bin/index.js +2 -1
- package/bin/reciple/classes/RecipleClient.d.ts +4 -4
- package/bin/reciple/classes/RecipleClient.js +11 -12
- package/bin/reciple/classes/RecipleConfig.js +2 -2
- package/bin/reciple/classes/builders/InteractionCommandBuilder.d.ts +8 -4
- package/bin/reciple/classes/builders/InteractionCommandBuilder.js +11 -4
- package/bin/reciple/classes/builders/MessageCommandBuilder.d.ts +5 -5
- package/bin/reciple/classes/builders/MessageCommandBuilder.js +2 -2
- package/bin/reciple/logger.js +1 -1
- package/bin/reciple/modules.d.ts +1 -1
- package/bin/reciple/modules.js +2 -2
- package/bin/reciple/permissions.d.ts +9 -2
- package/bin/reciple/permissions.js +17 -1
- package/bin/reciple/registerInteractionCommands.d.ts +1 -1
- package/bin/reciple/registerInteractionCommands.js +2 -2
- package/bin/reciple/types/commands.d.ts +1 -1
- package/bin/reciple/types/paramOptions.d.ts +2 -2
- package/package.json +1 -1
- package/bin/reciple/isIgnoredChannel.d.ts +0 -5
- package/bin/reciple/isIgnoredChannel.js +0 -16
package/README.md
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
<h1 align="center">
|
|
2
2
|
<img src="https://i.imgur.com/DWM0tJL.png" width="50%">
|
|
3
3
|
<br>
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
<a href="https://npmjs.org/package/reciple">
|
|
5
|
+
<img src="https://img.shields.io/npm/v/reciple?label=latest%20npm%20release%20">
|
|
6
|
+
</a>
|
|
7
|
+
<a href="https://github.com/FalloutStudios/Reciple/blob/main/LICENSE">
|
|
8
|
+
<img src="https://img.shields.io/github/license/FalloutStudios/Reciple">
|
|
9
|
+
</a>
|
|
10
|
+
<a href="https://www.codefactor.io/repository/github/falloutstudios/reciple/overview/main">
|
|
11
|
+
<img src="https://www.codefactor.io/repository/github/falloutstudios/reciple/badge/main">
|
|
12
|
+
</a>
|
|
7
13
|
</h1>
|
|
8
14
|
|
|
9
15
|
A simple Dicord.js command handler that just works.
|
package/bin/bin.js
CHANGED
|
@@ -11,12 +11,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
};
|
|
12
12
|
var _a, _b;
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
const RecipleConfig_1 = require("./reciple/classes/RecipleConfig");
|
|
15
14
|
const RecipleClient_1 = require("./reciple/classes/RecipleClient");
|
|
16
|
-
const
|
|
17
|
-
const version_1 = require("./reciple/version");
|
|
15
|
+
const RecipleConfig_1 = require("./reciple/classes/RecipleConfig");
|
|
18
16
|
const flags_1 = require("./reciple/flags");
|
|
17
|
+
const version_1 = require("./reciple/version");
|
|
19
18
|
const fallout_utility_1 = require("fallout-utility");
|
|
19
|
+
const fs_1 = require("fs");
|
|
20
20
|
require("dotenv/config");
|
|
21
21
|
if (flags_1.flags.version) {
|
|
22
22
|
console.log(`v${version_1.version}`);
|
package/bin/index.d.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
export * from './reciple/classes/RecipleClient';
|
|
2
2
|
export * from './reciple/classes/RecipleConfig';
|
|
3
|
+
export * from './reciple/classes/CommandCooldownManager';
|
|
3
4
|
export * from './reciple/classes/MessageCommandOptionManager';
|
|
4
5
|
export * from './reciple/classes/builders/InteractionCommandBuilder';
|
|
5
6
|
export * from './reciple/classes/builders/MessageCommandBuilder';
|
|
6
7
|
export * from './reciple/classes/builders/MessageCommandOptionBuilder';
|
|
7
8
|
export * from './reciple/types/builders';
|
|
8
9
|
export * from './reciple/types/commands';
|
|
10
|
+
export * from './reciple/types/paramOptions';
|
|
9
11
|
export * from './reciple/permissions';
|
|
10
12
|
export * from './reciple/flags';
|
|
11
|
-
export * from './reciple/isIgnoredChannel';
|
|
12
13
|
export * from './reciple/logger';
|
|
13
14
|
export * from './reciple/modules';
|
|
14
15
|
export * from './reciple/registerInteractionCommands';
|
package/bin/index.js
CHANGED
|
@@ -16,15 +16,16 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./reciple/classes/RecipleClient"), exports);
|
|
18
18
|
__exportStar(require("./reciple/classes/RecipleConfig"), exports);
|
|
19
|
+
__exportStar(require("./reciple/classes/CommandCooldownManager"), exports);
|
|
19
20
|
__exportStar(require("./reciple/classes/MessageCommandOptionManager"), exports);
|
|
20
21
|
__exportStar(require("./reciple/classes/builders/InteractionCommandBuilder"), exports);
|
|
21
22
|
__exportStar(require("./reciple/classes/builders/MessageCommandBuilder"), exports);
|
|
22
23
|
__exportStar(require("./reciple/classes/builders/MessageCommandOptionBuilder"), exports);
|
|
23
24
|
__exportStar(require("./reciple/types/builders"), exports);
|
|
24
25
|
__exportStar(require("./reciple/types/commands"), exports);
|
|
26
|
+
__exportStar(require("./reciple/types/paramOptions"), exports);
|
|
25
27
|
__exportStar(require("./reciple/permissions"), exports);
|
|
26
28
|
__exportStar(require("./reciple/flags"), exports);
|
|
27
|
-
__exportStar(require("./reciple/isIgnoredChannel"), exports);
|
|
28
29
|
__exportStar(require("./reciple/logger"), exports);
|
|
29
30
|
__exportStar(require("./reciple/modules"), exports);
|
|
30
31
|
__exportStar(require("./reciple/registerInteractionCommands"), exports);
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
+
import { RecipleModule } from '../modules';
|
|
2
|
+
import { InteractionBuilder } from '../registerInteractionCommands';
|
|
1
3
|
import { RecipleCommandBuilders, RecipleCommandBuilderType } from '../types/builders';
|
|
4
|
+
import { AddModuleOptions } from '../types/paramOptions';
|
|
2
5
|
import { InteractionCommandBuilder, RecipleInteractionCommandExecuteData } from './builders/InteractionCommandBuilder';
|
|
3
6
|
import { MessageCommandBuilder, RecipleMessageCommandExecuteData } from './builders/MessageCommandBuilder';
|
|
4
|
-
import { InteractionBuilder } from '../registerInteractionCommands';
|
|
5
7
|
import { CommandCooldownManager } from './CommandCooldownManager';
|
|
6
|
-
import { Logger as ILogger } from 'fallout-utility';
|
|
7
|
-
import { AddModuleOptions } from '../types/paramOptions';
|
|
8
|
-
import { RecipleModule } from '../modules';
|
|
9
8
|
import { Config } from './RecipleConfig';
|
|
10
9
|
import { ApplicationCommandData, Awaitable, Client, ClientEvents, ClientOptions, CommandInteraction, Interaction, Message } from 'discord.js';
|
|
10
|
+
import { Logger as ILogger } from 'fallout-utility';
|
|
11
11
|
export interface RecipleClientOptions extends ClientOptions {
|
|
12
12
|
config?: Config;
|
|
13
13
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// Not cool code
|
|
3
2
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
4
3
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
5
4
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -11,19 +10,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
10
|
};
|
|
12
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
12
|
exports.RecipleClient = void 0;
|
|
14
|
-
|
|
15
|
-
const
|
|
13
|
+
// Not cool code
|
|
14
|
+
const logger_1 = require("../logger");
|
|
15
|
+
const modules_1 = require("../modules");
|
|
16
16
|
const permissions_1 = require("../permissions");
|
|
17
|
+
const registerInteractionCommands_1 = require("../registerInteractionCommands");
|
|
18
|
+
const builders_1 = require("../types/builders");
|
|
19
|
+
const commands_1 = require("../types/commands");
|
|
20
|
+
const version_1 = require("../version");
|
|
17
21
|
const CommandCooldownManager_1 = require("./CommandCooldownManager");
|
|
18
22
|
const MessageCommandOptionManager_1 = require("./MessageCommandOptionManager");
|
|
19
|
-
const fallout_utility_1 = require("fallout-utility");
|
|
20
|
-
const commands_1 = require("../types/commands");
|
|
21
|
-
const modules_1 = require("../modules");
|
|
22
23
|
const RecipleConfig_1 = require("./RecipleConfig");
|
|
23
|
-
const isIgnoredChannel_1 = require("../isIgnoredChannel");
|
|
24
|
-
const version_1 = require("../version");
|
|
25
|
-
const logger_1 = require("../logger");
|
|
26
24
|
const discord_js_1 = require("discord.js");
|
|
25
|
+
const fallout_utility_1 = require("fallout-utility");
|
|
27
26
|
class RecipleClient extends discord_js_1.Client {
|
|
28
27
|
constructor(options) {
|
|
29
28
|
var _a, _b, _c;
|
|
@@ -176,7 +175,7 @@ class RecipleClient extends discord_js_1.Client {
|
|
|
176
175
|
if (!command.allowExecuteInDM && message.channel.type === discord_js_1.ChannelType.DM
|
|
177
176
|
|| !command.allowExecuteByBots
|
|
178
177
|
&& (message.author.bot || message.author.system)
|
|
179
|
-
|| (0,
|
|
178
|
+
|| (0, permissions_1.isIgnoredChannel)(message.channelId, this.config.ignoredChannels))
|
|
180
179
|
return;
|
|
181
180
|
if (command.validateOptions) {
|
|
182
181
|
if (commandOptions.some(o => o.invalid)) {
|
|
@@ -237,7 +236,7 @@ class RecipleClient extends discord_js_1.Client {
|
|
|
237
236
|
interactionCommandExecute(interaction) {
|
|
238
237
|
var _a, _b;
|
|
239
238
|
return __awaiter(this, void 0, void 0, function* () {
|
|
240
|
-
if (!interaction || interaction.type !== discord_js_1.InteractionType.ApplicationCommand || !this.isReady())
|
|
239
|
+
if (!interaction || interaction.type !== discord_js_1.InteractionType.ApplicationCommand || !interaction.isChatInputCommand() || !this.isReady())
|
|
241
240
|
return;
|
|
242
241
|
const command = this.findCommand(interaction.commandName, builders_1.RecipleCommandBuilderType.InteractionCommand);
|
|
243
242
|
if (!command)
|
|
@@ -248,7 +247,7 @@ class RecipleClient extends discord_js_1.Client {
|
|
|
248
247
|
client: this
|
|
249
248
|
};
|
|
250
249
|
if ((0, permissions_1.userHasCommandPermissions)(command.name, (_a = interaction.memberPermissions) !== null && _a !== void 0 ? _a : undefined, this.config.commands.interactionCommand.permissions, command)) {
|
|
251
|
-
if (!command || (0,
|
|
250
|
+
if (!command || (0, permissions_1.isIgnoredChannel)(interaction.channelId, this.config.ignoredChannels))
|
|
252
251
|
return;
|
|
253
252
|
if (interaction.guild && !(0, permissions_1.botHasExecutePermissions)(interaction.guild, command.requiredBotPermissions)) {
|
|
254
253
|
if (!command.halt || !(yield command.halt({ executeData, reason: commands_1.RecipleHaltedCommandReason.MissingBotPermissions }))) {
|
|
@@ -4,10 +4,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.RecipleConfig = void 0;
|
|
7
|
-
const
|
|
7
|
+
const flags_1 = require("../flags");
|
|
8
8
|
const version_1 = require("../version");
|
|
9
9
|
const fallout_utility_1 = require("fallout-utility");
|
|
10
|
-
const
|
|
10
|
+
const fs_1 = require("fs");
|
|
11
11
|
const path_1 = __importDefault(require("path"));
|
|
12
12
|
const yaml_1 = __importDefault(require("yaml"));
|
|
13
13
|
class RecipleConfig {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RecipleCommandBuilderType } from '../../types/builders';
|
|
2
2
|
import { RecipleHaltedCommandData } from '../../types/commands';
|
|
3
|
-
import { SlashCommandBuilder } from '@discordjs/builders';
|
|
4
3
|
import { RecipleClient } from '../RecipleClient';
|
|
5
|
-
import {
|
|
4
|
+
import { SlashCommandBuilder } from '@discordjs/builders';
|
|
5
|
+
import { Awaitable, ChatInputCommandInteraction, PermissionResolvable } from 'discord.js';
|
|
6
6
|
export interface RecipleInteractionCommandExecuteData {
|
|
7
|
-
interaction:
|
|
7
|
+
interaction: ChatInputCommandInteraction;
|
|
8
8
|
builder: InteractionCommandBuilder;
|
|
9
9
|
client: RecipleClient<true>;
|
|
10
10
|
}
|
|
@@ -21,6 +21,10 @@ export declare class InteractionCommandBuilder extends SlashCommandBuilder {
|
|
|
21
21
|
* - `0` means no cooldown
|
|
22
22
|
*/
|
|
23
23
|
setCooldown(cooldown: number): InteractionCommandBuilder;
|
|
24
|
+
/**
|
|
25
|
+
* Set required bot permissions to execute the command
|
|
26
|
+
*/
|
|
27
|
+
setRequiredBotPermissions(...permissions: PermissionResolvable[]): InteractionCommandBuilder;
|
|
24
28
|
/**
|
|
25
29
|
* Set required permissions to execute the command
|
|
26
30
|
*/
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.InteractionCommandBuilder = void 0;
|
|
4
|
-
const builders_1 = require("
|
|
5
|
-
const builders_2 = require("
|
|
6
|
-
class InteractionCommandBuilder extends
|
|
4
|
+
const builders_1 = require("../../types/builders");
|
|
5
|
+
const builders_2 = require("@discordjs/builders");
|
|
6
|
+
class InteractionCommandBuilder extends builders_2.SlashCommandBuilder {
|
|
7
7
|
constructor() {
|
|
8
8
|
super(...arguments);
|
|
9
|
-
this.builder =
|
|
9
|
+
this.builder = builders_1.RecipleCommandBuilderType.InteractionCommand;
|
|
10
10
|
this.cooldown = 0;
|
|
11
11
|
this.requiredBotPermissions = [];
|
|
12
12
|
this.RequiredUserPermissions = [];
|
|
@@ -21,6 +21,13 @@ class InteractionCommandBuilder extends builders_1.SlashCommandBuilder {
|
|
|
21
21
|
this.cooldown = cooldown;
|
|
22
22
|
return this;
|
|
23
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Set required bot permissions to execute the command
|
|
26
|
+
*/
|
|
27
|
+
setRequiredBotPermissions(...permissions) {
|
|
28
|
+
this.requiredBotPermissions = permissions;
|
|
29
|
+
return this;
|
|
30
|
+
}
|
|
24
31
|
/**
|
|
25
32
|
* Set required permissions to execute the command
|
|
26
33
|
*/
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RecipleCommandBuilderType } from '../../types/builders';
|
|
2
|
+
import { RecipleHaltedCommandData } from '../../types/commands';
|
|
2
3
|
import { MessageCommandOptionManager } from '../MessageCommandOptionManager';
|
|
4
|
+
import { RecipleClient } from '../RecipleClient';
|
|
5
|
+
import { MessageCommandOptionBuilder } from './MessageCommandOptionBuilder';
|
|
3
6
|
import { Awaitable, Message, PermissionResolvable } from 'discord.js';
|
|
4
|
-
import { RecipleHaltedCommandData } from '../../types/commands';
|
|
5
7
|
import { Command as CommandMessage } from 'fallout-utility';
|
|
6
|
-
import { RecipleClient } from '../RecipleClient';
|
|
7
|
-
import { RecipleCommandBuilderType } from '../../types/builders';
|
|
8
8
|
export interface RecipleMessageCommandExecuteData {
|
|
9
9
|
message: Message;
|
|
10
10
|
options: MessageCommandOptionManager;
|
|
@@ -51,7 +51,7 @@ export declare class MessageCommandBuilder {
|
|
|
51
51
|
*/
|
|
52
52
|
addAliases(...aliases: string[]): MessageCommandBuilder;
|
|
53
53
|
/**
|
|
54
|
-
* Set required
|
|
54
|
+
* Set required bot permissions to execute the command
|
|
55
55
|
*/
|
|
56
56
|
setRequiredBotPermissions(...permissions: PermissionResolvable[]): MessageCommandBuilder;
|
|
57
57
|
/**
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MessageCommandBuilder = void 0;
|
|
4
|
-
const MessageCommandOptionBuilder_1 = require("./MessageCommandOptionBuilder");
|
|
5
4
|
const builders_1 = require("../../types/builders");
|
|
5
|
+
const MessageCommandOptionBuilder_1 = require("./MessageCommandOptionBuilder");
|
|
6
6
|
class MessageCommandBuilder {
|
|
7
7
|
constructor() {
|
|
8
8
|
this.builder = builders_1.RecipleCommandBuilderType.MessageCommand;
|
|
@@ -58,7 +58,7 @@ class MessageCommandBuilder {
|
|
|
58
58
|
return this;
|
|
59
59
|
}
|
|
60
60
|
/**
|
|
61
|
-
* Set required
|
|
61
|
+
* Set required bot permissions to execute the command
|
|
62
62
|
*/
|
|
63
63
|
setRequiredBotPermissions(...permissions) {
|
|
64
64
|
this.requiredBotPermissions = permissions;
|
package/bin/reciple/logger.js
CHANGED
|
@@ -4,9 +4,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.logger = void 0;
|
|
7
|
-
const fallout_utility_1 = require("fallout-utility");
|
|
8
7
|
const flags_1 = require("./flags");
|
|
9
8
|
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
+
const fallout_utility_1 = require("fallout-utility");
|
|
10
10
|
/**
|
|
11
11
|
* Create new logger
|
|
12
12
|
*/
|
package/bin/reciple/modules.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { RecipleCommandBuilders } from './types/builders';
|
|
2
1
|
import { RecipleClient } from './classes/RecipleClient';
|
|
2
|
+
import { RecipleCommandBuilders } from './types/builders';
|
|
3
3
|
export declare type LoadedModules = {
|
|
4
4
|
commands: RecipleCommandBuilders[];
|
|
5
5
|
modules: RecipleModule[];
|
package/bin/reciple/modules.js
CHANGED
|
@@ -14,10 +14,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.loadModules = void 0;
|
|
16
16
|
const builders_1 = require("./types/builders");
|
|
17
|
-
const fs_1 = require("fs");
|
|
18
17
|
const version_1 = require("./version");
|
|
19
|
-
const
|
|
18
|
+
const fs_1 = require("fs");
|
|
20
19
|
const path_1 = __importDefault(require("path"));
|
|
20
|
+
const wildcard_match_1 = __importDefault(require("wildcard-match"));
|
|
21
21
|
/**
|
|
22
22
|
* Load modules from folder
|
|
23
23
|
*/
|
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
import { Guild, PermissionResolvable, PermissionsBitField } from 'discord.js';
|
|
2
|
-
import { RecipleCommandBuilders } from './types/builders';
|
|
3
1
|
import { Config } from './classes/RecipleConfig';
|
|
2
|
+
import { RecipleCommandBuilders } from './types/builders';
|
|
3
|
+
import { Guild, PermissionResolvable, PermissionsBitField } from 'discord.js';
|
|
4
4
|
/**
|
|
5
5
|
* Check if the user has permissions to execute the given command name
|
|
6
6
|
*/
|
|
7
7
|
export declare function userHasCommandPermissions(commandName: string, memberPermissions?: PermissionsBitField, configConmmandPermissions?: Config['commands']['messageCommand']['permissions'] | Config['commands']['interactionCommand']['permissions'], builder?: RecipleCommandBuilders): boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Check if the bot has the required permissions in a guild
|
|
10
|
+
*/
|
|
8
11
|
export declare function botHasExecutePermissions(guild?: Guild, requiredPermissions?: PermissionResolvable[]): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Check if the channel id is ignored in config file
|
|
14
|
+
*/
|
|
15
|
+
export declare function isIgnoredChannel(channelId: string, ignoredChannelsConfig?: Config["ignoredChannels"]): boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.botHasExecutePermissions = exports.userHasCommandPermissions = void 0;
|
|
3
|
+
exports.isIgnoredChannel = exports.botHasExecutePermissions = exports.userHasCommandPermissions = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Check if the user has permissions to execute the given command name
|
|
6
6
|
*/
|
|
@@ -14,6 +14,9 @@ function userHasCommandPermissions(commandName, memberPermissions, configConmman
|
|
|
14
14
|
return memberPermissions ? memberPermissions.has(command.permissions) : false;
|
|
15
15
|
}
|
|
16
16
|
exports.userHasCommandPermissions = userHasCommandPermissions;
|
|
17
|
+
/**
|
|
18
|
+
* Check if the bot has the required permissions in a guild
|
|
19
|
+
*/
|
|
17
20
|
function botHasExecutePermissions(guild, requiredPermissions) {
|
|
18
21
|
var _a;
|
|
19
22
|
if (!(requiredPermissions === null || requiredPermissions === void 0 ? void 0 : requiredPermissions.length))
|
|
@@ -21,3 +24,16 @@ function botHasExecutePermissions(guild, requiredPermissions) {
|
|
|
21
24
|
return (guild === null || guild === void 0 ? void 0 : guild.members.me) ? (_a = guild.members.me) === null || _a === void 0 ? void 0 : _a.permissions.has(requiredPermissions) : false;
|
|
22
25
|
}
|
|
23
26
|
exports.botHasExecutePermissions = botHasExecutePermissions;
|
|
27
|
+
/**
|
|
28
|
+
* Check if the channel id is ignored in config file
|
|
29
|
+
*/
|
|
30
|
+
function isIgnoredChannel(channelId, ignoredChannelsConfig) {
|
|
31
|
+
if (!(ignoredChannelsConfig === null || ignoredChannelsConfig === void 0 ? void 0 : ignoredChannelsConfig.enabled))
|
|
32
|
+
return false;
|
|
33
|
+
if (ignoredChannelsConfig.channels.includes(channelId) && !ignoredChannelsConfig.convertToAllowList)
|
|
34
|
+
return true;
|
|
35
|
+
if (!ignoredChannelsConfig.channels.includes(channelId) && ignoredChannelsConfig.convertToAllowList)
|
|
36
|
+
return true;
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
exports.isIgnoredChannel = isIgnoredChannel;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { InteractionCommandBuilder } from './classes/builders/InteractionCommandBuilder';
|
|
2
|
-
import { ContextMenuCommandBuilder, SlashCommandBuilder } from '@discordjs/builders';
|
|
3
2
|
import { RegisterInteractionCommandsOptions } from './types/paramOptions';
|
|
3
|
+
import { ContextMenuCommandBuilder, SlashCommandBuilder } from '@discordjs/builders';
|
|
4
4
|
export declare type InteractionBuilder = ContextMenuCommandBuilder | InteractionCommandBuilder | SlashCommandBuilder;
|
|
5
5
|
/**
|
|
6
6
|
* Register interaction commands
|
|
@@ -17,8 +17,8 @@ const InteractionCommandBuilder_1 = require("./classes/builders/InteractionComma
|
|
|
17
17
|
function registerInteractionCommands(options) {
|
|
18
18
|
var _a, _b, _c, _d;
|
|
19
19
|
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
-
|
|
21
|
-
guilds = typeof guilds == 'string' ? [guilds] : guilds;
|
|
20
|
+
const client = options.client;
|
|
21
|
+
const guilds = typeof options.guilds == 'string' ? [options.guilds] : options.guilds;
|
|
22
22
|
const commands = (_b = Object.values((_a = options.commands) !== null && _a !== void 0 ? _a : client.commands.interactionCommands).map(cmd => {
|
|
23
23
|
var _a, _b;
|
|
24
24
|
if (typeof (cmd === null || cmd === void 0 ? void 0 : cmd.toJSON) == 'undefined')
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { InteractionCommandBuilder, RecipleInteractionCommandExecuteData } from '../classes/builders/InteractionCommandBuilder';
|
|
2
2
|
import { RecipleMessageCommandExecuteData } from '../classes/builders/MessageCommandBuilder';
|
|
3
|
-
import { MessageCommandOptionManager } from '../classes/MessageCommandOptionManager';
|
|
4
3
|
import { CooledDownUser } from '../classes/CommandCooldownManager';
|
|
4
|
+
import { MessageCommandOptionManager } from '../classes/MessageCommandOptionManager';
|
|
5
5
|
import { RecipleCommandBuilders } from '../types/builders';
|
|
6
6
|
export declare type RecipleHaltedCommandData<Builder extends RecipleCommandBuilders> = CommandErrorData<Builder> | CommandCooldownData<Builder> | (Builder extends InteractionCommandBuilder ? never : CommandInvalidArguments<Builder> | CommandMissingArguments<Builder>) | CommandMissingMemberPermissions<Builder> | CommandMissingBotPermissions<Builder>;
|
|
7
7
|
export interface CommandHaltBaseData<Builder extends RecipleCommandBuilders> {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { InteractionBuilder } from '../registerInteractionCommands';
|
|
2
|
-
import { RecipleModule, RecipleScript } from '../modules';
|
|
3
1
|
import { RecipleClient } from '../classes/RecipleClient';
|
|
2
|
+
import { RecipleModule, RecipleScript } from '../modules';
|
|
3
|
+
import { InteractionBuilder } from '../registerInteractionCommands';
|
|
4
4
|
import { ApplicationCommandData } from 'discord.js';
|
|
5
5
|
export interface AddModuleOptions {
|
|
6
6
|
/**
|
package/package.json
CHANGED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isIgnoredChannel = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Check if the channel id is ignored in config file
|
|
6
|
-
*/
|
|
7
|
-
function isIgnoredChannel(channelId, ignoredChannelsConfig) {
|
|
8
|
-
if (!(ignoredChannelsConfig === null || ignoredChannelsConfig === void 0 ? void 0 : ignoredChannelsConfig.enabled))
|
|
9
|
-
return false;
|
|
10
|
-
if (ignoredChannelsConfig.channels.includes(channelId) && !ignoredChannelsConfig.convertToAllowList)
|
|
11
|
-
return true;
|
|
12
|
-
if (!ignoredChannelsConfig.channels.includes(channelId) && ignoredChannelsConfig.convertToAllowList)
|
|
13
|
-
return true;
|
|
14
|
-
return false;
|
|
15
|
-
}
|
|
16
|
-
exports.isIgnoredChannel = isIgnoredChannel;
|