necord 3.0.8 → 4.0.0-dev.1642467129.4f37121
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/.prettierrc +1 -1
- package/README.md +6 -3
- package/dist/context/index.d.ts +3 -4
- package/dist/context/index.js +15 -16
- package/dist/context/necord-arguments-host.d.ts +13 -11
- package/dist/context/necord-arguments-host.js +22 -19
- package/dist/context/necord-execution-context.d.ts +6 -8
- package/dist/context/necord-execution-context.js +13 -19
- package/dist/context/necord-params.factory.d.ts +9 -5
- package/dist/context/necord-params.factory.js +23 -25
- package/dist/decorators/autocomplete.decorator.d.ts +3 -0
- package/dist/decorators/autocomplete.decorator.js +7 -0
- package/dist/decorators/commands.decorator.d.ts +5 -10
- package/dist/decorators/commands.decorator.js +36 -7
- package/dist/decorators/components.decorator.d.ts +2 -2
- package/dist/decorators/components.decorator.js +8 -6
- package/dist/decorators/guilds.decorator.d.ts +3 -0
- package/dist/decorators/guilds.decorator.js +9 -0
- package/dist/decorators/index.d.ts +7 -6
- package/dist/decorators/index.js +19 -18
- package/dist/decorators/listeners.decorator.d.ts +3 -2
- package/dist/decorators/listeners.decorator.js +13 -6
- package/dist/decorators/options.decorator.d.ts +65 -37
- package/dist/decorators/options.decorator.js +22 -13
- package/dist/decorators/params.decorator.d.ts +4 -4
- package/dist/decorators/params.decorator.js +16 -16
- package/dist/{utils/create-necord-params.util.d.ts → decorators/params.util.d.ts} +4 -4
- package/dist/{utils/create-necord-params.util.js → decorators/params.util.js} +24 -24
- package/dist/exceptions/index.d.ts +1 -0
- package/dist/{services → exceptions}/index.js +13 -17
- package/dist/exceptions/necord.exception.d.ts +2 -0
- package/dist/exceptions/necord.exception.js +6 -0
- package/dist/index.d.ts +6 -4
- package/dist/index.js +18 -16
- package/dist/interfaces/index.d.ts +3 -5
- package/dist/interfaces/index.js +15 -17
- package/dist/interfaces/necord-events.interface.d.ts +84 -0
- package/dist/interfaces/{command-metadata.interface.js → necord-events.interface.js} +2 -2
- package/dist/interfaces/necord-metadata.interface.d.ts +38 -0
- package/dist/interfaces/{component-metadata.interface.js → necord-metadata.interface.js} +2 -2
- package/dist/interfaces/{module-options.interface.d.ts → necord-options.interface.d.ts} +15 -16
- package/dist/interfaces/{listener-metadata.interface.js → necord-options.interface.js} +2 -2
- package/dist/necord-explorer.d.ts +29 -0
- package/dist/necord-explorer.js +116 -0
- package/dist/necord-interaction.update.d.ts +9 -0
- package/dist/necord-interaction.update.js +123 -0
- package/dist/necord-registry.d.ts +24 -0
- package/dist/necord-registry.js +78 -0
- package/dist/necord.constants.d.ts +11 -8
- package/dist/necord.constants.js +15 -12
- package/dist/necord.module.d.ts +18 -14
- package/dist/necord.module.js +123 -116
- package/dist/necord.update.d.ts +21 -7
- package/dist/necord.update.js +325 -69
- package/package.json +14 -10
- package/dist/context/necord-paramtype.enum.d.ts +0 -6
- package/dist/context/necord-paramtype.enum.js +0 -10
- package/dist/decorators/groups.decorator.d.ts +0 -3
- package/dist/decorators/groups.decorator.js +0 -9
- package/dist/interfaces/command-metadata.interface.d.ts +0 -6
- package/dist/interfaces/component-metadata.interface.d.ts +0 -5
- package/dist/interfaces/listener-metadata.interface.d.ts +0 -5
- package/dist/interfaces/module-options.interface.js +0 -2
- package/dist/interfaces/option-metadata.interface.d.ts +0 -7
- package/dist/interfaces/option-metadata.interface.js +0 -2
- package/dist/services/commands.service.d.ts +0 -19
- package/dist/services/commands.service.js +0 -169
- package/dist/services/components.service.d.ts +0 -13
- package/dist/services/components.service.js +0 -51
- package/dist/services/explorer.service.d.ts +0 -17
- package/dist/services/explorer.service.js +0 -54
- package/dist/services/index.d.ts +0 -5
- package/dist/services/listeners.service.d.ts +0 -12
- package/dist/services/listeners.service.js +0 -47
- package/dist/services/metadata-accessor.service.d.ts +0 -13
- package/dist/services/metadata-accessor.service.js +0 -44
- package/dist/utils/create-necord-commands.util.d.ts +0 -4
- package/dist/utils/create-necord-commands.util.js +0 -9
- package/dist/utils/create-necord-components.util.d.ts +0 -2
- package/dist/utils/create-necord-components.util.js +0 -9
- package/dist/utils/create-necord-listeners.util.d.ts +0 -3
- package/dist/utils/create-necord-listeners.util.js +0 -12
- package/dist/utils/create-necord-options.util.d.ts +0 -2
- package/dist/utils/create-necord-options.util.js +0 -15
- package/dist/utils/index.d.ts +0 -5
- package/dist/utils/index.js +0 -17
package/.prettierrc
CHANGED
package/README.md
CHANGED
|
@@ -65,20 +65,23 @@ Then create `app.update.ts` file and add `On`/`Once` decorators for handling Dis
|
|
|
65
65
|
|
|
66
66
|
```typescript
|
|
67
67
|
import { Injectable, Logger } from '@nestjs/common';
|
|
68
|
-
import { Context, On, Once } from 'necord';
|
|
68
|
+
import { Context, On, Once, ContextOf } from 'necord';
|
|
69
69
|
import { Client } from 'discord.js';
|
|
70
70
|
|
|
71
71
|
@Injectable()
|
|
72
72
|
export class AppUpdate {
|
|
73
73
|
private readonly logger = new Logger(AppUpdate.name);
|
|
74
74
|
|
|
75
|
+
public constructor(private readonly client: Client) {
|
|
76
|
+
}
|
|
77
|
+
|
|
75
78
|
@Once('ready')
|
|
76
|
-
public onReady(@Context() client:
|
|
79
|
+
public onReady(@Context() [client]: ContextOf<'ready'>) {
|
|
77
80
|
this.logger.log(`Bot logged in as ${client.user.username}`);
|
|
78
81
|
}
|
|
79
82
|
|
|
80
83
|
@On('warn')
|
|
81
|
-
public onWarn(@Context() message:
|
|
84
|
+
public onWarn(@Context() [message]: ContextOf<'warn'>) {
|
|
82
85
|
this.logger.warn(message);
|
|
83
86
|
}
|
|
84
87
|
}
|
package/dist/context/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export * from './necord-arguments-host';
|
|
2
|
-
export * from './necord-execution-context';
|
|
3
|
-
export * from './necord-
|
|
4
|
-
export * from './necord-params.factory';
|
|
1
|
+
export * from './necord-arguments-host';
|
|
2
|
+
export * from './necord-execution-context';
|
|
3
|
+
export * from './necord-params.factory';
|
package/dist/context/index.js
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
-
};
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
__exportStar(require("./necord-arguments-host"), exports);
|
|
14
|
-
__exportStar(require("./necord-execution-context"), exports);
|
|
15
|
-
__exportStar(require("./necord-
|
|
16
|
-
__exportStar(require("./necord-params.factory"), exports);
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./necord-arguments-host"), exports);
|
|
14
|
+
__exportStar(require("./necord-execution-context"), exports);
|
|
15
|
+
__exportStar(require("./necord-params.factory"), exports);
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { ExecutionContextHost } from '@nestjs/core/helpers/execution-context-host';
|
|
2
|
-
import { ArgumentsHost } from '@nestjs/common';
|
|
3
|
-
import { NecordContextType } from './necord-execution-context';
|
|
4
|
-
export interface INecordArgumentsHost extends ArgumentsHost {
|
|
5
|
-
getContext<T = any>(): T;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { ExecutionContextHost } from '@nestjs/core/helpers/execution-context-host';
|
|
2
|
+
import { ArgumentsHost } from '@nestjs/common';
|
|
3
|
+
import { NecordContextType } from './necord-execution-context';
|
|
4
|
+
export interface INecordArgumentsHost extends ArgumentsHost {
|
|
5
|
+
getContext<T = any>(): T;
|
|
6
|
+
getOptions<T = any>(): T;
|
|
7
|
+
}
|
|
8
|
+
export declare class NecordArgumentsHost extends ExecutionContextHost implements INecordArgumentsHost {
|
|
9
|
+
static create(context: ArgumentsHost): NecordArgumentsHost;
|
|
10
|
+
getType<TContext extends string = NecordContextType>(): TContext;
|
|
11
|
+
getContext<T = any>(): T;
|
|
12
|
+
getOptions<T = any>(): T;
|
|
13
|
+
}
|
|
@@ -1,19 +1,22 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NecordArgumentsHost = void 0;
|
|
4
|
-
const execution_context_host_1 = require("@nestjs/core/helpers/execution-context-host");
|
|
5
|
-
class NecordArgumentsHost extends execution_context_host_1.ExecutionContextHost {
|
|
6
|
-
static create(context) {
|
|
7
|
-
const type = context.getType();
|
|
8
|
-
const necContext = new NecordArgumentsHost(context.getArgs());
|
|
9
|
-
necContext.setType(type);
|
|
10
|
-
return necContext;
|
|
11
|
-
}
|
|
12
|
-
getType() {
|
|
13
|
-
return super.getType();
|
|
14
|
-
}
|
|
15
|
-
getContext() {
|
|
16
|
-
return this.getArgByIndex(0);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NecordArgumentsHost = void 0;
|
|
4
|
+
const execution_context_host_1 = require("@nestjs/core/helpers/execution-context-host");
|
|
5
|
+
class NecordArgumentsHost extends execution_context_host_1.ExecutionContextHost {
|
|
6
|
+
static create(context) {
|
|
7
|
+
const type = context.getType();
|
|
8
|
+
const necContext = new NecordArgumentsHost(context.getArgs());
|
|
9
|
+
necContext.setType(type);
|
|
10
|
+
return necContext;
|
|
11
|
+
}
|
|
12
|
+
getType() {
|
|
13
|
+
return super.getType();
|
|
14
|
+
}
|
|
15
|
+
getContext() {
|
|
16
|
+
return this.getArgByIndex(0);
|
|
17
|
+
}
|
|
18
|
+
getOptions() {
|
|
19
|
+
return this.getArgByIndex(1);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.NecordArgumentsHost = NecordArgumentsHost;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { ContextType, ExecutionContext } from '@nestjs/common';
|
|
2
|
-
import { NecordArgumentsHost } from './necord-arguments-host';
|
|
3
|
-
export declare type NecordContextType = 'necord' | ContextType;
|
|
4
|
-
export declare class NecordExecutionContext extends NecordArgumentsHost {
|
|
5
|
-
static create(context: ExecutionContext): NecordExecutionContext;
|
|
6
|
-
|
|
7
|
-
getContext<T = any>(): T;
|
|
8
|
-
}
|
|
1
|
+
import { ContextType, ExecutionContext } from '@nestjs/common';
|
|
2
|
+
import { NecordArgumentsHost } from './necord-arguments-host';
|
|
3
|
+
export declare type NecordContextType = 'necord' | ContextType;
|
|
4
|
+
export declare class NecordExecutionContext extends NecordArgumentsHost {
|
|
5
|
+
static create(context: ExecutionContext): NecordExecutionContext;
|
|
6
|
+
}
|
|
@@ -1,19 +1,13 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NecordExecutionContext = void 0;
|
|
4
|
-
const necord_arguments_host_1 = require("./necord-arguments-host");
|
|
5
|
-
class NecordExecutionContext extends necord_arguments_host_1.NecordArgumentsHost {
|
|
6
|
-
static create(context) {
|
|
7
|
-
const type = context.getType();
|
|
8
|
-
const necContext = new NecordExecutionContext(context.getArgs(), context.getClass(), context.getHandler());
|
|
9
|
-
necContext.setType(type);
|
|
10
|
-
return necContext;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
getContext() {
|
|
16
|
-
return this.getArgByIndex(0);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
exports.NecordExecutionContext = NecordExecutionContext;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NecordExecutionContext = void 0;
|
|
4
|
+
const necord_arguments_host_1 = require("./necord-arguments-host");
|
|
5
|
+
class NecordExecutionContext extends necord_arguments_host_1.NecordArgumentsHost {
|
|
6
|
+
static create(context) {
|
|
7
|
+
const type = context.getType();
|
|
8
|
+
const necContext = new NecordExecutionContext(context.getArgs(), context.getClass(), context.getHandler());
|
|
9
|
+
necContext.setType(type);
|
|
10
|
+
return necContext;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.NecordExecutionContext = NecordExecutionContext;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
export declare
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { ParamData } from '@nestjs/common';
|
|
2
|
+
import { ParamsFactory } from '@nestjs/core/helpers/external-context-creator';
|
|
3
|
+
export declare enum NecordParamType {
|
|
4
|
+
CONTEXT = 0,
|
|
5
|
+
OPTIONS = 1
|
|
6
|
+
}
|
|
7
|
+
export declare class NecordParamsFactory implements ParamsFactory {
|
|
8
|
+
exchangeKeyForValue(type: number, data: ParamData, args: unknown): any;
|
|
9
|
+
}
|
|
@@ -1,25 +1,23 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NecordParamsFactory = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
case
|
|
15
|
-
return
|
|
16
|
-
case
|
|
17
|
-
return
|
|
18
|
-
|
|
19
|
-
return
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
exports.NecordParamsFactory = NecordParamsFactory;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NecordParamsFactory = exports.NecordParamType = void 0;
|
|
4
|
+
var NecordParamType;
|
|
5
|
+
(function (NecordParamType) {
|
|
6
|
+
NecordParamType[NecordParamType["CONTEXT"] = 0] = "CONTEXT";
|
|
7
|
+
NecordParamType[NecordParamType["OPTIONS"] = 1] = "OPTIONS";
|
|
8
|
+
})(NecordParamType = exports.NecordParamType || (exports.NecordParamType = {}));
|
|
9
|
+
class NecordParamsFactory {
|
|
10
|
+
exchangeKeyForValue(type, data, args) {
|
|
11
|
+
if (!args)
|
|
12
|
+
return null;
|
|
13
|
+
switch (type) {
|
|
14
|
+
case NecordParamType.CONTEXT:
|
|
15
|
+
return args[0];
|
|
16
|
+
case NecordParamType.OPTIONS:
|
|
17
|
+
return data ? args[1][data] : args[1];
|
|
18
|
+
default:
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.NecordParamsFactory = NecordParamsFactory;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Autocomplete = void 0;
|
|
4
|
+
const common_1 = require("@nestjs/common");
|
|
5
|
+
const necord_constants_1 = require("../necord.constants");
|
|
6
|
+
const Autocomplete = (autocomplete) => (0, common_1.SetMetadata)(necord_constants_1.AUTOCOMPLETE_METADATA, autocomplete);
|
|
7
|
+
exports.Autocomplete = Autocomplete;
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const SlashCommand: (
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export declare const
|
|
6
|
-
type: ApplicationCommandTypes.USER;
|
|
7
|
-
}, "type" | "options">) => MethodDecorator;
|
|
8
|
-
export declare const MessageCommand: (options: Omit<import("discord.js").MessageApplicationCommandData & {
|
|
9
|
-
type: ApplicationCommandTypes.MESSAGE;
|
|
10
|
-
}, "type" | "options">) => MethodDecorator;
|
|
1
|
+
export declare const SlashGroup: (name: string, description: string, defaultPermission?: boolean) => MethodDecorator & ClassDecorator;
|
|
2
|
+
export declare const SlashCommand: (name: string, description: string, defaultPermission?: boolean) => MethodDecorator;
|
|
3
|
+
export declare const TextCommand: (name: string, description?: string) => import("@nestjs/common").CustomDecorator<string>;
|
|
4
|
+
export declare const UserCommand: (name: string) => MethodDecorator;
|
|
5
|
+
export declare const MessageCommand: (name: string) => MethodDecorator;
|
|
@@ -1,7 +1,36 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MessageCommand = exports.UserCommand = exports.SlashCommand = void 0;
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MessageCommand = exports.UserCommand = exports.TextCommand = exports.SlashCommand = exports.SlashGroup = void 0;
|
|
4
|
+
const necord_constants_1 = require("../necord.constants");
|
|
5
|
+
const common_1 = require("@nestjs/common");
|
|
6
|
+
const SlashGroup = (name, description, defaultPermission = true) => (target, propertyKey, descriptor) => {
|
|
7
|
+
(0, common_1.SetMetadata)(necord_constants_1.GROUP_METADATA, {
|
|
8
|
+
type: !propertyKey
|
|
9
|
+
? 1 /* CHAT_INPUT */
|
|
10
|
+
: 2 /* SUB_COMMAND_GROUP */,
|
|
11
|
+
name,
|
|
12
|
+
description,
|
|
13
|
+
options: [],
|
|
14
|
+
defaultPermission
|
|
15
|
+
})(target, propertyKey, descriptor);
|
|
16
|
+
};
|
|
17
|
+
exports.SlashGroup = SlashGroup;
|
|
18
|
+
const SlashCommand = (name, description, defaultPermission = true) => (0, common_1.SetMetadata)(necord_constants_1.APPLICATION_COMMAND_METADATA, {
|
|
19
|
+
type: 1 /* CHAT_INPUT */,
|
|
20
|
+
name,
|
|
21
|
+
description,
|
|
22
|
+
defaultPermission,
|
|
23
|
+
options: []
|
|
24
|
+
});
|
|
25
|
+
exports.SlashCommand = SlashCommand;
|
|
26
|
+
const TextCommand = (name, description) => (0, common_1.SetMetadata)(necord_constants_1.TEXT_COMMAND_METADATA, {
|
|
27
|
+
name,
|
|
28
|
+
description
|
|
29
|
+
});
|
|
30
|
+
exports.TextCommand = TextCommand;
|
|
31
|
+
const createNecordContextMenu = (type) => (name) => (0, common_1.SetMetadata)(necord_constants_1.APPLICATION_COMMAND_METADATA, {
|
|
32
|
+
type,
|
|
33
|
+
name
|
|
34
|
+
});
|
|
35
|
+
exports.UserCommand = createNecordContextMenu('USER');
|
|
36
|
+
exports.MessageCommand = createNecordContextMenu('MESSAGE');
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const Button: (customId: string) => MethodDecorator;
|
|
2
|
-
export declare const SelectMenu: (customId: string) => MethodDecorator;
|
|
1
|
+
export declare const Button: (customId: string) => MethodDecorator;
|
|
2
|
+
export declare const SelectMenu: (customId: string) => MethodDecorator;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SelectMenu = exports.Button = void 0;
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SelectMenu = exports.Button = void 0;
|
|
4
|
+
const common_1 = require("@nestjs/common");
|
|
5
|
+
const necord_constants_1 = require("../necord.constants");
|
|
6
|
+
const createNecordComponentDecorator = (type) => (customId) => (0, common_1.SetMetadata)(necord_constants_1.MESSAGE_COMPONENT_METADATA, { type, customId });
|
|
7
|
+
exports.Button = createNecordComponentDecorator('BUTTON');
|
|
8
|
+
exports.SelectMenu = createNecordComponentDecorator('SELECT_MENU');
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { ApplicationCommandPermissionData, Snowflake } from 'discord.js';
|
|
2
|
+
export declare const Guilds: (guildIds: Snowflake[]) => ClassDecorator & MethodDecorator;
|
|
3
|
+
export declare const Permissions: (permissions: ApplicationCommandPermissionData[]) => ClassDecorator & MethodDecorator;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Permissions = exports.Guilds = void 0;
|
|
4
|
+
const common_1 = require("@nestjs/common");
|
|
5
|
+
const necord_constants_1 = require("../necord.constants");
|
|
6
|
+
const Guilds = (guildIds) => (0, common_1.SetMetadata)(necord_constants_1.GUILDS_METADATA, guildIds);
|
|
7
|
+
exports.Guilds = Guilds;
|
|
8
|
+
const Permissions = (permissions) => (0, common_1.SetMetadata)(necord_constants_1.PERMISSIONS_METADATA, permissions);
|
|
9
|
+
exports.Permissions = Permissions;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './
|
|
3
|
-
export * from './
|
|
4
|
-
export * from './
|
|
5
|
-
export * from './
|
|
6
|
-
export * from './
|
|
1
|
+
export * from './autocomplete.decorator';
|
|
2
|
+
export * from './commands.decorator';
|
|
3
|
+
export * from './components.decorator';
|
|
4
|
+
export * from './guilds.decorator';
|
|
5
|
+
export * from './listeners.decorator';
|
|
6
|
+
export * from './options.decorator';
|
|
7
|
+
export * from './params.decorator';
|
package/dist/decorators/index.js
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
-
};
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
__exportStar(require("./
|
|
14
|
-
__exportStar(require("./
|
|
15
|
-
__exportStar(require("./
|
|
16
|
-
__exportStar(require("./
|
|
17
|
-
__exportStar(require("./
|
|
18
|
-
__exportStar(require("./
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./autocomplete.decorator"), exports);
|
|
14
|
+
__exportStar(require("./commands.decorator"), exports);
|
|
15
|
+
__exportStar(require("./components.decorator"), exports);
|
|
16
|
+
__exportStar(require("./guilds.decorator"), exports);
|
|
17
|
+
__exportStar(require("./listeners.decorator"), exports);
|
|
18
|
+
__exportStar(require("./options.decorator"), exports);
|
|
19
|
+
__exportStar(require("./params.decorator"), exports);
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const
|
|
1
|
+
import { NecordEvents } from '../interfaces';
|
|
2
|
+
export declare const On: <T extends keyof NecordEvents = keyof NecordEvents>(event: T) => MethodDecorator;
|
|
3
|
+
export declare const Once: <T extends keyof NecordEvents = keyof NecordEvents>(event: T) => MethodDecorator;
|
|
@@ -1,6 +1,13 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Once = exports.On = void 0;
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
exports.
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Once = exports.On = void 0;
|
|
4
|
+
const common_1 = require("@nestjs/common");
|
|
5
|
+
const necord_constants_1 = require("../necord.constants");
|
|
6
|
+
exports.On = createNecordListenerDecorator('on');
|
|
7
|
+
exports.Once = createNecordListenerDecorator('once');
|
|
8
|
+
function createNecordListenerDecorator(type) {
|
|
9
|
+
return (event) => (0, common_1.SetMetadata)(necord_constants_1.LISTENERS_METADATA, {
|
|
10
|
+
type,
|
|
11
|
+
event
|
|
12
|
+
});
|
|
13
|
+
}
|
|
@@ -1,37 +1,65 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
methodName?: keyof import("discord.js").CommandInteractionOptionResolver<import("discord.js").CacheType>;
|
|
5
|
-
}, "type" | "methodName">) => PropertyDecorator;
|
|
6
|
-
export declare const IntegerOption: (data: Omit<import("discord.js").ApplicationCommandChoicesData & {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
1
|
+
export declare const BooleanOption: (data: Omit<import("discord.js").ApplicationCommandNonOptionsData & {
|
|
2
|
+
type: "BOOLEAN";
|
|
3
|
+
} & {
|
|
4
|
+
methodName?: keyof import("discord.js").CommandInteractionOptionResolver<import("discord.js").CacheType>;
|
|
5
|
+
}, "type" | "methodName"> | Omit<never, "type" | "methodName"> | Omit<never, "type" | "methodName"> | Omit<never, "type" | "methodName"> | Omit<never, "type" | "methodName">) => PropertyDecorator;
|
|
6
|
+
export declare const IntegerOption: (data: Omit<never, "type" | "methodName"> | Omit<never, "type" | "methodName"> | Omit<import("discord.js").ApplicationCommandChoicesData & {
|
|
7
|
+
type: "INTEGER";
|
|
8
|
+
} & {
|
|
9
|
+
methodName?: keyof import("discord.js").CommandInteractionOptionResolver<import("discord.js").CacheType>;
|
|
10
|
+
}, "type" | "methodName"> | Omit<import("discord.js").ApplicationCommandAutocompleteOption & {
|
|
11
|
+
type: "INTEGER";
|
|
12
|
+
} & {
|
|
13
|
+
methodName?: keyof import("discord.js").CommandInteractionOptionResolver<import("discord.js").CacheType>;
|
|
14
|
+
}, "type" | "methodName"> | Omit<import("discord.js").ApplicationCommandNumericOptionData & {
|
|
15
|
+
type: "INTEGER";
|
|
16
|
+
} & {
|
|
17
|
+
methodName?: keyof import("discord.js").CommandInteractionOptionResolver<import("discord.js").CacheType>;
|
|
18
|
+
}, "type" | "methodName">) => PropertyDecorator;
|
|
19
|
+
export declare const NumberOption: (data: Omit<never, "type" | "methodName"> | Omit<never, "type" | "methodName"> | Omit<import("discord.js").ApplicationCommandChoicesData & {
|
|
20
|
+
type: "NUMBER";
|
|
21
|
+
} & {
|
|
22
|
+
methodName?: keyof import("discord.js").CommandInteractionOptionResolver<import("discord.js").CacheType>;
|
|
23
|
+
}, "type" | "methodName"> | Omit<import("discord.js").ApplicationCommandAutocompleteOption & {
|
|
24
|
+
type: "NUMBER";
|
|
25
|
+
} & {
|
|
26
|
+
methodName?: keyof import("discord.js").CommandInteractionOptionResolver<import("discord.js").CacheType>;
|
|
27
|
+
}, "type" | "methodName"> | Omit<import("discord.js").ApplicationCommandNumericOptionData & {
|
|
28
|
+
type: "NUMBER";
|
|
29
|
+
} & {
|
|
30
|
+
methodName?: keyof import("discord.js").CommandInteractionOptionResolver<import("discord.js").CacheType>;
|
|
31
|
+
}, "type" | "methodName">) => PropertyDecorator;
|
|
32
|
+
export declare const StringOption: (data: Omit<never, "type" | "methodName"> | Omit<never, "type" | "methodName"> | Omit<import("discord.js").ApplicationCommandChoicesData & {
|
|
33
|
+
type: "STRING";
|
|
34
|
+
} & {
|
|
35
|
+
methodName?: keyof import("discord.js").CommandInteractionOptionResolver<import("discord.js").CacheType>;
|
|
36
|
+
}, "type" | "methodName"> | Omit<import("discord.js").ApplicationCommandAutocompleteOption & {
|
|
37
|
+
type: "STRING";
|
|
38
|
+
} & {
|
|
39
|
+
methodName?: keyof import("discord.js").CommandInteractionOptionResolver<import("discord.js").CacheType>;
|
|
40
|
+
}, "type" | "methodName"> | Omit<never, "type" | "methodName">) => PropertyDecorator;
|
|
41
|
+
export declare const UserOption: (data: Omit<import("discord.js").ApplicationCommandNonOptionsData & {
|
|
42
|
+
type: "USER";
|
|
43
|
+
} & {
|
|
44
|
+
methodName?: keyof import("discord.js").CommandInteractionOptionResolver<import("discord.js").CacheType>;
|
|
45
|
+
}, "type" | "methodName"> | Omit<never, "type" | "methodName"> | Omit<never, "type" | "methodName"> | Omit<never, "type" | "methodName"> | Omit<never, "type" | "methodName">) => PropertyDecorator;
|
|
46
|
+
export declare const MemberOption: (data: Omit<import("discord.js").ApplicationCommandNonOptionsData & {
|
|
47
|
+
type: "USER";
|
|
48
|
+
} & {
|
|
49
|
+
methodName?: keyof import("discord.js").CommandInteractionOptionResolver<import("discord.js").CacheType>;
|
|
50
|
+
}, "type" | "methodName"> | Omit<never, "type" | "methodName"> | Omit<never, "type" | "methodName"> | Omit<never, "type" | "methodName"> | Omit<never, "type" | "methodName">) => PropertyDecorator;
|
|
51
|
+
export declare const ChannelOption: (data: Omit<never, "type" | "methodName"> | Omit<import("discord.js").ApplicationCommandChannelOptionData & {
|
|
52
|
+
type: "CHANNEL";
|
|
53
|
+
} & {
|
|
54
|
+
methodName?: keyof import("discord.js").CommandInteractionOptionResolver<import("discord.js").CacheType>;
|
|
55
|
+
}, "type" | "methodName"> | Omit<never, "type" | "methodName"> | Omit<never, "type" | "methodName"> | Omit<never, "type" | "methodName">) => PropertyDecorator;
|
|
56
|
+
export declare const RoleOption: (data: Omit<import("discord.js").ApplicationCommandNonOptionsData & {
|
|
57
|
+
type: "ROLE";
|
|
58
|
+
} & {
|
|
59
|
+
methodName?: keyof import("discord.js").CommandInteractionOptionResolver<import("discord.js").CacheType>;
|
|
60
|
+
}, "type" | "methodName"> | Omit<never, "type" | "methodName"> | Omit<never, "type" | "methodName"> | Omit<never, "type" | "methodName"> | Omit<never, "type" | "methodName">) => PropertyDecorator;
|
|
61
|
+
export declare const MentionableOption: (data: Omit<import("discord.js").ApplicationCommandNonOptionsData & {
|
|
62
|
+
type: "MENTIONABLE";
|
|
63
|
+
} & {
|
|
64
|
+
methodName?: keyof import("discord.js").CommandInteractionOptionResolver<import("discord.js").CacheType>;
|
|
65
|
+
}, "type" | "methodName"> | Omit<never, "type" | "methodName"> | Omit<never, "type" | "methodName"> | Omit<never, "type" | "methodName"> | Omit<never, "type" | "methodName">) => PropertyDecorator;
|
|
@@ -1,13 +1,22 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MentionableOption = exports.RoleOption = exports.ChannelOption = exports.MemberOption = exports.UserOption = exports.StringOption = exports.NumberOption = exports.IntegerOption = exports.BooleanOption = void 0;
|
|
4
|
-
const
|
|
5
|
-
exports.BooleanOption =
|
|
6
|
-
exports.IntegerOption =
|
|
7
|
-
exports.NumberOption =
|
|
8
|
-
exports.StringOption =
|
|
9
|
-
exports.UserOption =
|
|
10
|
-
exports.MemberOption =
|
|
11
|
-
exports.ChannelOption = (
|
|
12
|
-
exports.RoleOption =
|
|
13
|
-
exports.MentionableOption =
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MentionableOption = exports.RoleOption = exports.ChannelOption = exports.MemberOption = exports.UserOption = exports.StringOption = exports.NumberOption = exports.IntegerOption = exports.BooleanOption = void 0;
|
|
4
|
+
const necord_constants_1 = require("../necord.constants");
|
|
5
|
+
exports.BooleanOption = createNecordOptionDecorator('BOOLEAN', 'getBoolean');
|
|
6
|
+
exports.IntegerOption = createNecordOptionDecorator('INTEGER', 'getInteger');
|
|
7
|
+
exports.NumberOption = createNecordOptionDecorator('NUMBER', 'getNumber');
|
|
8
|
+
exports.StringOption = createNecordOptionDecorator('STRING', 'getString');
|
|
9
|
+
exports.UserOption = createNecordOptionDecorator('USER', 'getUser');
|
|
10
|
+
exports.MemberOption = createNecordOptionDecorator('USER', 'getMember');
|
|
11
|
+
exports.ChannelOption = createNecordOptionDecorator('CHANNEL', 'getChannel');
|
|
12
|
+
exports.RoleOption = createNecordOptionDecorator('ROLE', 'getRole');
|
|
13
|
+
exports.MentionableOption = createNecordOptionDecorator('MENTIONABLE', 'getMentionable');
|
|
14
|
+
function createNecordOptionDecorator(type, methodName) {
|
|
15
|
+
return (data) => (target, propertyKey) => {
|
|
16
|
+
var _a;
|
|
17
|
+
const options = (_a = Reflect.getMetadata(necord_constants_1.OPTIONS_METADATA, target.constructor)) !== null && _a !== void 0 ? _a : {};
|
|
18
|
+
options[propertyKey] = Object.assign(Object.assign({}, data), { type,
|
|
19
|
+
methodName });
|
|
20
|
+
Reflect.defineMetadata(necord_constants_1.OPTIONS_METADATA, options, target.constructor);
|
|
21
|
+
};
|
|
22
|
+
}
|