necord 4.2.6 → 4.2.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/dist/context/index.js +5 -1
- package/dist/decorators/index.d.ts +0 -1
- package/dist/decorators/index.js +5 -2
- package/dist/exceptions/index.js +5 -1
- package/dist/index.js +5 -1
- package/dist/interfaces/index.js +5 -1
- package/dist/necord-explorer.js +1 -5
- package/dist/necord-interaction.update.js +1 -15
- package/dist/necord.constants.d.ts +0 -1
- package/dist/necord.constants.js +1 -2
- package/package.json +1 -1
- package/dist/decorators/permissions.decorator.d.ts +0 -6
- package/dist/decorators/permissions.decorator.js +0 -17
package/dist/context/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
package/dist/decorators/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -17,4 +21,3 @@ __exportStar(require("./guilds.decorator"), exports);
|
|
|
17
21
|
__exportStar(require("./listeners.decorator"), exports);
|
|
18
22
|
__exportStar(require("./options.decorator"), exports);
|
|
19
23
|
__exportStar(require("./params.decorator"), exports);
|
|
20
|
-
__exportStar(require("./permissions.decorator"), exports);
|
package/dist/exceptions/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
package/dist/interfaces/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
package/dist/necord-explorer.js
CHANGED
|
@@ -48,10 +48,6 @@ let NecordExplorer = class NecordExplorer {
|
|
|
48
48
|
{
|
|
49
49
|
key: necord_constants_1.GUILDS_METADATA,
|
|
50
50
|
fn: (key, targets) => this.reflector.getAllAndOverride(key, targets)
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
key: necord_constants_1.PERMISSIONS_METADATA,
|
|
54
|
-
fn: (key, targets) => this.reflector.getAllAndMerge(key, targets)
|
|
55
51
|
}
|
|
56
52
|
];
|
|
57
53
|
for (const command of this.filterProperties(wrapper, metadataKey, optionalKeys)) {
|
|
@@ -66,7 +62,7 @@ let NecordExplorer = class NecordExplorer {
|
|
|
66
62
|
: subCommands.push(command);
|
|
67
63
|
}
|
|
68
64
|
if (commandGroup) {
|
|
69
|
-
commandGroup.metadata = this.extractOptionalMetadata([necord_constants_1.GUILDS_METADATA
|
|
65
|
+
commandGroup.metadata = this.extractOptionalMetadata([necord_constants_1.GUILDS_METADATA], wrapper.instance);
|
|
70
66
|
commandGroup.options = [...subGroups.values(), ...subCommands];
|
|
71
67
|
}
|
|
72
68
|
return commands.concat(commandGroup);
|
|
@@ -53,21 +53,7 @@ let NecordInteractionUpdate = NecordInteractionUpdate_1 = class NecordInteractio
|
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
this.logger.log(`Started refreshing application commands.`);
|
|
56
|
-
|
|
57
|
-
const registeredCommands = yield clientCommands.set(commands, guild);
|
|
58
|
-
if (!guild)
|
|
59
|
-
continue;
|
|
60
|
-
yield clientCommands.permissions.set({
|
|
61
|
-
guild,
|
|
62
|
-
fullPermissions: commands.map(command => {
|
|
63
|
-
var _a;
|
|
64
|
-
return ({
|
|
65
|
-
id: registeredCommands.find(x => x.name === command.name).id,
|
|
66
|
-
permissions: (_a = command.metadata[necord_constants_1.PERMISSIONS_METADATA]) !== null && _a !== void 0 ? _a : []
|
|
67
|
-
});
|
|
68
|
-
})
|
|
69
|
-
});
|
|
70
|
-
}
|
|
56
|
+
yield Promise.all([...commandsByGuildMap.entries()].map(([guild, commands]) => clientCommands.set(commands, guild)));
|
|
71
57
|
this.logger.log(`Successfully reloaded application commands.`);
|
|
72
58
|
});
|
|
73
59
|
}
|
|
@@ -8,4 +8,3 @@ export declare const AUTOCOMPLETE_METADATA = "necord:autocomplete_metadata";
|
|
|
8
8
|
export declare const GROUP_METADATA = "necord:group_meta";
|
|
9
9
|
export declare const OPTIONS_METADATA = "necord:options_meta";
|
|
10
10
|
export declare const GUILDS_METADATA = "necord:guilds_meta";
|
|
11
|
-
export declare const PERMISSIONS_METADATA = "necord:permissions_meta";
|
package/dist/necord.constants.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.GUILDS_METADATA = exports.OPTIONS_METADATA = exports.GROUP_METADATA = exports.AUTOCOMPLETE_METADATA = exports.LISTENERS_METADATA = exports.MESSAGE_COMPONENT_METADATA = exports.APPLICATION_COMMAND_METADATA = exports.TEXT_COMMAND_METADATA = exports.PARAM_ARGS_METADATA = exports.NECORD_MODULE_OPTIONS = void 0;
|
|
4
4
|
const constants_1 = require("@nestjs/common/constants");
|
|
5
5
|
exports.NECORD_MODULE_OPTIONS = 'necord:module_options';
|
|
6
6
|
exports.PARAM_ARGS_METADATA = constants_1.ROUTE_ARGS_METADATA;
|
|
@@ -12,4 +12,3 @@ exports.AUTOCOMPLETE_METADATA = 'necord:autocomplete_metadata';
|
|
|
12
12
|
exports.GROUP_METADATA = 'necord:group_meta';
|
|
13
13
|
exports.OPTIONS_METADATA = 'necord:options_meta';
|
|
14
14
|
exports.GUILDS_METADATA = 'necord:guilds_meta';
|
|
15
|
-
exports.PERMISSIONS_METADATA = 'necord:permissions_meta';
|
package/package.json
CHANGED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { ApplicationCommandPermissionData } from 'discord.js';
|
|
2
|
-
export declare const Permissions: (...permissions: TypedPermissions<unknown>) => ClassDecorator & MethodDecorator;
|
|
3
|
-
export declare const UserPermissions: (...permissions: TypedPermissions<string>) => ClassDecorator & MethodDecorator;
|
|
4
|
-
export declare const RolePermissions: (...permissions: TypedPermissions<string>) => ClassDecorator & MethodDecorator;
|
|
5
|
-
declare type TypedPermissions<T> = Omit<ApplicationCommandPermissionData, T extends string ? 'type' : never>[];
|
|
6
|
-
export {};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RolePermissions = exports.UserPermissions = exports.Permissions = void 0;
|
|
4
|
-
const necord_constants_1 = require("../necord.constants");
|
|
5
|
-
exports.Permissions = createNecordPermissionsDecorator();
|
|
6
|
-
exports.UserPermissions = createNecordPermissionsDecorator('USER');
|
|
7
|
-
exports.RolePermissions = createNecordPermissionsDecorator('ROLE');
|
|
8
|
-
function createNecordPermissionsDecorator(type) {
|
|
9
|
-
return (...permissions) => (target, propertyKey) => {
|
|
10
|
-
var _a, _b;
|
|
11
|
-
const metadataTarget = (_a = target[propertyKey]) !== null && _a !== void 0 ? _a : target;
|
|
12
|
-
const existing = (_b = Reflect.getMetadata(necord_constants_1.PERMISSIONS_METADATA, metadataTarget)) !== null && _b !== void 0 ? _b : [];
|
|
13
|
-
Reflect.defineMetadata(necord_constants_1.PERMISSIONS_METADATA, existing
|
|
14
|
-
.concat(permissions)
|
|
15
|
-
.map(permission => { var _a; return (Object.assign(Object.assign({}, permission), { type: (_a = permission.type) !== null && _a !== void 0 ? _a : type })); }), metadataTarget);
|
|
16
|
-
};
|
|
17
|
-
}
|