reciple 1.0.12 → 1.0.15
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.
|
@@ -23,8 +23,8 @@ class RecipleClient extends discord_js_1.Client {
|
|
|
23
23
|
super(options);
|
|
24
24
|
this.commands = { MESSAGE_COMMANDS: {}, INTERACTION_COMMANDS: {} };
|
|
25
25
|
this.modules = [];
|
|
26
|
-
this.logger = (0, logger_1.logger)(false);
|
|
27
26
|
this.version = version_1.version;
|
|
27
|
+
this.logger = (0, logger_1.logger)(!!options.config.fileLogging.stringifyLoggedJSON, !!options.config.fileLogging.debugmode);
|
|
28
28
|
if (!options.config)
|
|
29
29
|
throw new Error('Config is not defined.');
|
|
30
30
|
this.config = options.config;
|
|
@@ -76,14 +76,16 @@ class RecipleClient extends discord_js_1.Client {
|
|
|
76
76
|
return this;
|
|
77
77
|
}
|
|
78
78
|
messageCommandExecute(message) {
|
|
79
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
79
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
80
80
|
return __awaiter(this, void 0, void 0, function* () {
|
|
81
81
|
if (!message.content || !((_a = this.config) === null || _a === void 0 ? void 0 : _a.commands.messageCommand.enabled))
|
|
82
82
|
return this;
|
|
83
83
|
const parseCommand = (0, fallout_utility_1.getCommand)(message.content, ((_b = this.config) === null || _b === void 0 ? void 0 : _b.prefix) || '!', ((_c = this.config) === null || _c === void 0 ? void 0 : _c.commands.messageCommand.commandArgumentSeparator) || ' ');
|
|
84
84
|
if (parseCommand && parseCommand.command) {
|
|
85
85
|
const command = this.commands.MESSAGE_COMMANDS[parseCommand.command];
|
|
86
|
-
if (command
|
|
86
|
+
if (!command)
|
|
87
|
+
return this;
|
|
88
|
+
if ((0, commandPermissions_1.commandPermissions)(command.name, ((_d = message.member) === null || _d === void 0 ? void 0 : _d.permissions) || null, (_e = this.config) === null || _e === void 0 ? void 0 : _e.permissions.messageCommands)) {
|
|
87
89
|
if (!command.allowExecuteInDM && message.channel.type === 'DM' || !command.allowExecuteByBots && (message.author.bot || message.author.system) || (0, isIgnoredChannel_1.isIgnoredChannel)(message.channelId, (_f = this.config) === null || _f === void 0 ? void 0 : _f.ignoredChannels))
|
|
88
90
|
return this;
|
|
89
91
|
if (command.validateOptions && !command.getCommandOptionValues(parseCommand)) {
|
|
@@ -99,19 +101,24 @@ class RecipleClient extends discord_js_1.Client {
|
|
|
99
101
|
yield Promise.resolve(command.execute(options)).catch(err => this._commandExecuteError(err, options));
|
|
100
102
|
this.emit('recipleMessageCommandCreate', options);
|
|
101
103
|
}
|
|
104
|
+
else {
|
|
105
|
+
yield message.reply(((_h = this.config) === null || _h === void 0 ? void 0 : _h.messages.noPermissions) || 'You do not have permission to use this command.').catch((err) => this.logger.error(err));
|
|
106
|
+
}
|
|
102
107
|
}
|
|
103
108
|
return this;
|
|
104
109
|
});
|
|
105
110
|
}
|
|
106
111
|
interactionCommandExecute(interaction) {
|
|
107
|
-
var _a, _b, _c;
|
|
112
|
+
var _a, _b, _c, _d;
|
|
108
113
|
return __awaiter(this, void 0, void 0, function* () {
|
|
109
114
|
if (!interaction || !interaction.isCommand() || !((_a = this.config) === null || _a === void 0 ? void 0 : _a.commands.interactionCommand.enabled))
|
|
110
115
|
return this;
|
|
111
116
|
const command = this.commands.INTERACTION_COMMANDS[interaction.commandName];
|
|
112
|
-
if (
|
|
117
|
+
if ((0, commandPermissions_1.commandPermissions)(command.name, interaction.memberPermissions, (_b = this.config) === null || _b === void 0 ? void 0 : _b.permissions.interactionCommands)) {
|
|
113
118
|
if (!command.allowExecuteInDM && interaction.member === null || (0, isIgnoredChannel_1.isIgnoredChannel)(interaction.channelId, (_c = this.config) === null || _c === void 0 ? void 0 : _c.ignoredChannels))
|
|
114
119
|
return this;
|
|
120
|
+
if (!command)
|
|
121
|
+
return this;
|
|
115
122
|
const options = {
|
|
116
123
|
interaction: interaction,
|
|
117
124
|
command: command,
|
|
@@ -121,6 +128,9 @@ class RecipleClient extends discord_js_1.Client {
|
|
|
121
128
|
yield Promise.resolve(command.execute(options)).catch(err => this._commandExecuteError(err, options));
|
|
122
129
|
this.emit('recipleInteractionCommandCreate', options);
|
|
123
130
|
}
|
|
131
|
+
else {
|
|
132
|
+
yield interaction.reply(((_d = this.config) === null || _d === void 0 ? void 0 : _d.messages.noPermissions) || 'You do not have permission to use this command.').catch((err) => this.logger.error(err));
|
|
133
|
+
}
|
|
124
134
|
return this;
|
|
125
135
|
});
|
|
126
136
|
}
|
package/bin/reciple/logger.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { Logger } from 'fallout-utility';
|
|
2
|
-
export declare function logger(stringifyJSON: boolean): Logger;
|
|
2
|
+
export declare function logger(stringifyJSON: boolean, debugmode?: boolean): Logger;
|
package/bin/reciple/logger.js
CHANGED
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.logger = void 0;
|
|
4
4
|
const fallout_utility_1 = require("fallout-utility");
|
|
5
|
-
function logger(stringifyJSON) {
|
|
5
|
+
function logger(stringifyJSON, debugmode = false) {
|
|
6
6
|
return new fallout_utility_1.Logger("Main", {
|
|
7
7
|
addPrefixToEveryJsonNewLines: stringifyJSON,
|
|
8
8
|
stringifyJSON: stringifyJSON,
|
|
9
|
+
setDebugging: debugmode
|
|
9
10
|
});
|
|
10
11
|
}
|
|
11
12
|
exports.logger = logger;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "reciple",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.15",
|
|
4
4
|
"description": "A Discord.js bot",
|
|
5
5
|
"author": "FalloutStudios",
|
|
6
6
|
"license": "GPL-3.0",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"commander": "^9.2.0",
|
|
28
28
|
"discord.js": "^13.6.0",
|
|
29
29
|
"dotenv": "^16.0.0",
|
|
30
|
-
"fallout-utility": "^1.3.
|
|
30
|
+
"fallout-utility": "^1.3.12",
|
|
31
31
|
"yaml": "^2.0.1"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
package/resource/reciple.yml
CHANGED
|
@@ -32,6 +32,8 @@ ignoredChannels:
|
|
|
32
32
|
|
|
33
33
|
fileLogging:
|
|
34
34
|
enabled: true
|
|
35
|
+
debugmode: false
|
|
36
|
+
stringifyLoggedJSON: false
|
|
35
37
|
logFilePath: './logs/latest.log'
|
|
36
38
|
|
|
37
39
|
client:
|
|
@@ -45,7 +47,7 @@ client:
|
|
|
45
47
|
|
|
46
48
|
messages:
|
|
47
49
|
notEnoughArguments: 'Not enough arguments.'
|
|
48
|
-
|
|
50
|
+
noPermissions:
|
|
49
51
|
content: 'You do not have permission to use this command.'
|
|
50
52
|
ephemeral: true
|
|
51
53
|
error:
|