necord 3.0.8 → 4.0.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/.prettierrc +1 -1
- package/README.md +6 -3
- package/dist/context/index.d.ts +0 -1
- package/dist/context/index.js +0 -1
- package/dist/context/necord-arguments-host.d.ts +2 -0
- package/dist/context/necord-arguments-host.js +3 -0
- package/dist/context/necord-execution-context.d.ts +0 -2
- package/dist/context/necord-execution-context.js +0 -6
- package/dist/context/necord-params.factory.d.ts +5 -1
- package/dist/context/necord-params.factory.js +11 -13
- 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 +34 -5
- package/dist/decorators/components.decorator.js +5 -3
- package/dist/decorators/guilds.decorator.d.ts +3 -0
- package/dist/decorators/guilds.decorator.js +9 -0
- package/dist/decorators/index.d.ts +2 -1
- package/dist/decorators/index.js +2 -1
- package/dist/decorators/listeners.decorator.d.ts +3 -2
- package/dist/decorators/listeners.decorator.js +10 -3
- package/dist/decorators/options.decorator.d.ts +49 -21
- package/dist/decorators/options.decorator.js +19 -10
- package/dist/decorators/params.decorator.d.ts +3 -3
- package/dist/decorators/params.decorator.js +6 -6
- package/dist/{utils/create-necord-params.util.d.ts → decorators/params.util.d.ts} +0 -0
- package/dist/{utils/create-necord-params.util.js → decorators/params.util.js} +0 -0
- package/dist/exceptions/index.d.ts +1 -0
- package/dist/{services → exceptions}/index.js +1 -5
- package/dist/exceptions/necord.exception.d.ts +2 -0
- package/dist/exceptions/necord.exception.js +6 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.js +4 -2
- package/dist/interfaces/index.d.ts +3 -5
- package/dist/interfaces/index.js +3 -5
- package/dist/interfaces/necord-events.interface.d.ts +84 -0
- package/dist/interfaces/{command-metadata.interface.js → necord-events.interface.js} +0 -0
- package/dist/interfaces/necord-metadata.interface.d.ts +38 -0
- package/dist/interfaces/{component-metadata.interface.js → necord-metadata.interface.js} +0 -0
- package/dist/interfaces/{module-options.interface.d.ts → necord-options.interface.d.ts} +2 -3
- package/dist/interfaces/{listener-metadata.interface.js → necord-options.interface.js} +0 -0
- 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 +4 -1
- package/dist/necord.constants.js +5 -2
- package/dist/necord.module.d.ts +5 -1
- package/dist/necord.module.js +19 -12
- package/dist/necord.update.d.ts +19 -5
- package/dist/necord.update.js +282 -26
- package/package.json +12 -8
- 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
package/dist/context/index.js
CHANGED
|
@@ -12,5 +12,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
__exportStar(require("./necord-arguments-host"), exports);
|
|
14
14
|
__exportStar(require("./necord-execution-context"), exports);
|
|
15
|
-
__exportStar(require("./necord-paramtype.enum"), exports);
|
|
16
15
|
__exportStar(require("./necord-params.factory"), exports);
|
|
@@ -3,9 +3,11 @@ import { ArgumentsHost } from '@nestjs/common';
|
|
|
3
3
|
import { NecordContextType } from './necord-execution-context';
|
|
4
4
|
export interface INecordArgumentsHost extends ArgumentsHost {
|
|
5
5
|
getContext<T = any>(): T;
|
|
6
|
+
getOptions<T = any>(): T;
|
|
6
7
|
}
|
|
7
8
|
export declare class NecordArgumentsHost extends ExecutionContextHost implements INecordArgumentsHost {
|
|
8
9
|
static create(context: ArgumentsHost): NecordArgumentsHost;
|
|
9
10
|
getType<TContext extends string = NecordContextType>(): TContext;
|
|
10
11
|
getContext<T = any>(): T;
|
|
12
|
+
getOptions<T = any>(): T;
|
|
11
13
|
}
|
|
@@ -3,6 +3,4 @@ import { NecordArgumentsHost } from './necord-arguments-host';
|
|
|
3
3
|
export declare type NecordContextType = 'necord' | ContextType;
|
|
4
4
|
export declare class NecordExecutionContext extends NecordArgumentsHost {
|
|
5
5
|
static create(context: ExecutionContext): NecordExecutionContext;
|
|
6
|
-
getType<TContext extends string = NecordContextType>(): TContext;
|
|
7
|
-
getContext<T = any>(): T;
|
|
8
6
|
}
|
|
@@ -9,11 +9,5 @@ class NecordExecutionContext extends necord_arguments_host_1.NecordArgumentsHost
|
|
|
9
9
|
necContext.setType(type);
|
|
10
10
|
return necContext;
|
|
11
11
|
}
|
|
12
|
-
getType() {
|
|
13
|
-
return super.getType();
|
|
14
|
-
}
|
|
15
|
-
getContext() {
|
|
16
|
-
return this.getArgByIndex(0);
|
|
17
|
-
}
|
|
18
12
|
}
|
|
19
13
|
exports.NecordExecutionContext = NecordExecutionContext;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import { ParamsFactory } from '@nestjs/core/helpers/external-context-creator';
|
|
2
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
|
+
}
|
|
3
7
|
export declare class NecordParamsFactory implements ParamsFactory {
|
|
4
8
|
exchangeKeyForValue(type: number, data: ParamData, args: unknown): any;
|
|
5
9
|
}
|
|
@@ -1,22 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NecordParamsFactory = void 0;
|
|
4
|
-
|
|
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 = {}));
|
|
5
9
|
class NecordParamsFactory {
|
|
6
10
|
exchangeKeyForValue(type, data, args) {
|
|
7
|
-
if (!args)
|
|
11
|
+
if (!args)
|
|
8
12
|
return null;
|
|
9
|
-
}
|
|
10
|
-
const context = args[0];
|
|
11
13
|
switch (type) {
|
|
12
|
-
case
|
|
13
|
-
return
|
|
14
|
-
case
|
|
15
|
-
return
|
|
16
|
-
case necord_paramtype_enum_1.NecordParamType.VALUES:
|
|
17
|
-
return context.isSelectMenu() ? context.values : null;
|
|
18
|
-
case necord_paramtype_enum_1.NecordParamType.COMPONENT:
|
|
19
|
-
return context.isMessageComponent() ? context.component : null;
|
|
14
|
+
case NecordParamType.CONTEXT:
|
|
15
|
+
return args[0];
|
|
16
|
+
case NecordParamType.OPTIONS:
|
|
17
|
+
return data ? args[1][data] : args[1];
|
|
20
18
|
default:
|
|
21
19
|
return null;
|
|
22
20
|
}
|
|
@@ -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
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MessageCommand = exports.UserCommand = exports.SlashCommand = void 0;
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SelectMenu = exports.Button = void 0;
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
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 './autocomplete.decorator';
|
|
1
2
|
export * from './commands.decorator';
|
|
2
3
|
export * from './components.decorator';
|
|
3
|
-
export * from './
|
|
4
|
+
export * from './guilds.decorator';
|
|
4
5
|
export * from './listeners.decorator';
|
|
5
6
|
export * from './options.decorator';
|
|
6
7
|
export * from './params.decorator';
|
package/dist/decorators/index.js
CHANGED
|
@@ -10,9 +10,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
10
10
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./autocomplete.decorator"), exports);
|
|
13
14
|
__exportStar(require("./commands.decorator"), exports);
|
|
14
15
|
__exportStar(require("./components.decorator"), exports);
|
|
15
|
-
__exportStar(require("./
|
|
16
|
+
__exportStar(require("./guilds.decorator"), exports);
|
|
16
17
|
__exportStar(require("./listeners.decorator"), exports);
|
|
17
18
|
__exportStar(require("./options.decorator"), exports);
|
|
18
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
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Once = exports.On = void 0;
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
exports.
|
|
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
|
-
import { ApplicationCommandOptionTypes } from 'discord.js/typings/enums';
|
|
2
1
|
export declare const BooleanOption: (data: Omit<import("discord.js").ApplicationCommandNonOptionsData & {
|
|
3
|
-
|
|
2
|
+
type: "BOOLEAN";
|
|
3
|
+
} & {
|
|
4
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
|
-
|
|
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
|
+
} & {
|
|
8
9
|
methodName?: keyof import("discord.js").CommandInteractionOptionResolver<import("discord.js").CacheType>;
|
|
9
|
-
}, "type" | "methodName">)
|
|
10
|
-
|
|
11
|
-
|
|
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
|
+
} & {
|
|
12
17
|
methodName?: keyof import("discord.js").CommandInteractionOptionResolver<import("discord.js").CacheType>;
|
|
13
18
|
}, "type" | "methodName">) => PropertyDecorator;
|
|
14
|
-
export declare const
|
|
15
|
-
|
|
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
|
+
} & {
|
|
16
30
|
methodName?: keyof import("discord.js").CommandInteractionOptionResolver<import("discord.js").CacheType>;
|
|
17
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;
|
|
18
41
|
export declare const UserOption: (data: Omit<import("discord.js").ApplicationCommandNonOptionsData & {
|
|
19
|
-
|
|
42
|
+
type: "USER";
|
|
43
|
+
} & {
|
|
20
44
|
methodName?: keyof import("discord.js").CommandInteractionOptionResolver<import("discord.js").CacheType>;
|
|
21
|
-
}, "type" | "methodName">) => PropertyDecorator;
|
|
45
|
+
}, "type" | "methodName"> | Omit<never, "type" | "methodName"> | Omit<never, "type" | "methodName"> | Omit<never, "type" | "methodName"> | Omit<never, "type" | "methodName">) => PropertyDecorator;
|
|
22
46
|
export declare const MemberOption: (data: Omit<import("discord.js").ApplicationCommandNonOptionsData & {
|
|
23
|
-
|
|
47
|
+
type: "USER";
|
|
48
|
+
} & {
|
|
24
49
|
methodName?: keyof import("discord.js").CommandInteractionOptionResolver<import("discord.js").CacheType>;
|
|
25
|
-
}, "type" | "methodName">) => PropertyDecorator;
|
|
26
|
-
export declare const ChannelOption: (data: Omit<import("discord.js").
|
|
27
|
-
|
|
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
|
+
} & {
|
|
28
54
|
methodName?: keyof import("discord.js").CommandInteractionOptionResolver<import("discord.js").CacheType>;
|
|
29
|
-
}, "type" | "methodName">) => PropertyDecorator;
|
|
55
|
+
}, "type" | "methodName"> | Omit<never, "type" | "methodName"> | Omit<never, "type" | "methodName"> | Omit<never, "type" | "methodName">) => PropertyDecorator;
|
|
30
56
|
export declare const RoleOption: (data: Omit<import("discord.js").ApplicationCommandNonOptionsData & {
|
|
31
|
-
|
|
57
|
+
type: "ROLE";
|
|
58
|
+
} & {
|
|
32
59
|
methodName?: keyof import("discord.js").CommandInteractionOptionResolver<import("discord.js").CacheType>;
|
|
33
|
-
}, "type" | "methodName">) => PropertyDecorator;
|
|
60
|
+
}, "type" | "methodName"> | Omit<never, "type" | "methodName"> | Omit<never, "type" | "methodName"> | Omit<never, "type" | "methodName"> | Omit<never, "type" | "methodName">) => PropertyDecorator;
|
|
34
61
|
export declare const MentionableOption: (data: Omit<import("discord.js").ApplicationCommandNonOptionsData & {
|
|
35
|
-
|
|
62
|
+
type: "MENTIONABLE";
|
|
63
|
+
} & {
|
|
36
64
|
methodName?: keyof import("discord.js").CommandInteractionOptionResolver<import("discord.js").CacheType>;
|
|
37
|
-
}, "type" | "methodName">) => PropertyDecorator;
|
|
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
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
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 =
|
|
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
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const Context: (
|
|
2
|
-
export declare const Component: (...pipes: (import("@nestjs/common").PipeTransform<any, any> | import("@nestjs/common").Type<import("@nestjs/common").PipeTransform<any, any>>)[]) => ParameterDecorator;
|
|
3
|
-
export declare const Values: (...pipes: (import("@nestjs/common").PipeTransform<any, any> | import("@nestjs/common").Type<import("@nestjs/common").PipeTransform<any, any>>)[]) => ParameterDecorator;
|
|
1
|
+
export declare const Context: (...pipes: (import("@nestjs/common").PipeTransform<any, any> | import("@nestjs/common").Type<import("@nestjs/common").PipeTransform<any, any>>)[]) => ParameterDecorator;
|
|
4
2
|
export declare const Options: (data?: any, ...pipes: (import("@nestjs/common").PipeTransform<any, any> | import("@nestjs/common").Type<import("@nestjs/common").PipeTransform<any, any>>)[]) => ParameterDecorator;
|
|
3
|
+
export declare const Ctx: (...pipes: (import("@nestjs/common").PipeTransform<any, any> | import("@nestjs/common").Type<import("@nestjs/common").PipeTransform<any, any>>)[]) => ParameterDecorator;
|
|
4
|
+
export declare const Opts: (data?: any, ...pipes: (import("@nestjs/common").PipeTransform<any, any> | import("@nestjs/common").Type<import("@nestjs/common").PipeTransform<any, any>>)[]) => ParameterDecorator;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.Opts = exports.Ctx = exports.Options = exports.Context = void 0;
|
|
4
4
|
const context_1 = require("../context");
|
|
5
5
|
const necord_constants_1 = require("../necord.constants");
|
|
6
|
-
const
|
|
7
|
-
exports.Context = (0,
|
|
8
|
-
exports.
|
|
9
|
-
exports.Values = (0, utils_1.createNecordParamDecorator)(context_1.NecordParamType.VALUES);
|
|
10
|
-
exports.Options = (0, utils_1.createNecordPipesParamDecorator)(context_1.NecordParamType.OPTIONS, [
|
|
6
|
+
const params_util_1 = require("./params.util");
|
|
7
|
+
exports.Context = (0, params_util_1.createNecordParamDecorator)(context_1.NecordParamType.CONTEXT);
|
|
8
|
+
exports.Options = (0, params_util_1.createNecordPipesParamDecorator)(context_1.NecordParamType.OPTIONS, [
|
|
11
9
|
(target, propertyKey, parameterIndex) => {
|
|
12
10
|
const paramTypes = Reflect.getMetadata('design:paramtypes', target, propertyKey);
|
|
13
11
|
const options = Reflect.getMetadata(necord_constants_1.OPTIONS_METADATA, paramTypes[parameterIndex]);
|
|
14
12
|
Reflect.defineMetadata(necord_constants_1.OPTIONS_METADATA, options, target[propertyKey]);
|
|
15
13
|
}
|
|
16
14
|
]);
|
|
15
|
+
exports.Ctx = exports.Context;
|
|
16
|
+
exports.Opts = exports.Options;
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './necord.exception';
|
|
@@ -10,8 +10,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
10
10
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
__exportStar(require("./
|
|
14
|
-
__exportStar(require("./components.service"), exports);
|
|
15
|
-
__exportStar(require("./explorer.service"), exports);
|
|
16
|
-
__exportStar(require("./listeners.service"), exports);
|
|
17
|
-
__exportStar(require("./metadata-accessor.service"), exports);
|
|
13
|
+
__exportStar(require("./necord.exception"), exports);
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -10,7 +10,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
10
10
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
__exportStar(require("./necord.module"), exports);
|
|
14
13
|
__exportStar(require("./context"), exports);
|
|
15
14
|
__exportStar(require("./decorators"), exports);
|
|
16
|
-
__exportStar(require("./
|
|
15
|
+
__exportStar(require("./exceptions"), exports);
|
|
16
|
+
__exportStar(require("./interfaces"), exports);
|
|
17
|
+
__exportStar(require("./necord.module"), exports);
|
|
18
|
+
__exportStar(require("./necord-registry"), exports);
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './
|
|
3
|
-
export * from './
|
|
4
|
-
export * from './module-options.interface';
|
|
5
|
-
export * from './option-metadata.interface';
|
|
1
|
+
export * from './necord-events.interface';
|
|
2
|
+
export * from './necord-metadata.interface';
|
|
3
|
+
export * from './necord-options.interface';
|
package/dist/interfaces/index.js
CHANGED
|
@@ -10,8 +10,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
10
10
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
__exportStar(require("./
|
|
14
|
-
__exportStar(require("./
|
|
15
|
-
__exportStar(require("./
|
|
16
|
-
__exportStar(require("./module-options.interface"), exports);
|
|
17
|
-
__exportStar(require("./option-metadata.interface"), exports);
|
|
13
|
+
__exportStar(require("./necord-events.interface"), exports);
|
|
14
|
+
__exportStar(require("./necord-metadata.interface"), exports);
|
|
15
|
+
__exportStar(require("./necord-options.interface"), exports);
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { ClientEvents, DMChannel, Guild, GuildFeatures, GuildMember, Message, NonThreadGuildBasedChannel, PartialMessage, PermissionOverwriteManager, Permissions, PremiumTier, PresenceStatus, Role, ThreadChannel, User, UserFlags, VoiceBasedChannel, VoiceChannel } from 'discord.js';
|
|
2
|
+
export interface NecordEvents extends ClientEvents {
|
|
3
|
+
guildChannelPermissionsUpdate: [
|
|
4
|
+
channel: DMChannel | NonThreadGuildBasedChannel,
|
|
5
|
+
oldPermissions: PermissionOverwriteManager,
|
|
6
|
+
newPermissions: PermissionOverwriteManager
|
|
7
|
+
];
|
|
8
|
+
guildChannelTopicUpdate: [
|
|
9
|
+
channel: DMChannel | NonThreadGuildBasedChannel,
|
|
10
|
+
oldTopic: string,
|
|
11
|
+
newTopic: string
|
|
12
|
+
];
|
|
13
|
+
guildMemberBoost: [member: GuildMember];
|
|
14
|
+
guildMemberUnboost: [member: GuildMember];
|
|
15
|
+
guildMemberRoleAdd: [member: GuildMember, role: Role];
|
|
16
|
+
guildMemberRoleRemove: [member: GuildMember, role: Role];
|
|
17
|
+
guildMemberNicknameUpdate: [member: GuildMember, oldNickname: string, newNickname: string];
|
|
18
|
+
guildMemberEntered: [member: GuildMember];
|
|
19
|
+
guildMemberAvatarAdd: [member: GuildMember, avatarURL: string];
|
|
20
|
+
guildMemberAvatarUpdate: [member: GuildMember, oldAvatarURL: string, newAvatarURL: string];
|
|
21
|
+
guildMemberAvatarRemove: [member: GuildMember, oldAvatarURL: string];
|
|
22
|
+
guildBoostLevelUp: [guild: Guild, oldPremiumTier: PremiumTier, newPremiumTier: PremiumTier];
|
|
23
|
+
guildBoostLevelDown: [oldGuild: Guild, newGuild: Guild];
|
|
24
|
+
guildBannerAdd: [guild: Guild, bannerURL: string];
|
|
25
|
+
guildAfkChannelAdd: [guild: Guild, afkChannel: VoiceChannel];
|
|
26
|
+
guildVanityURLAdd: [guild: Guild, vanityURLCode: string];
|
|
27
|
+
guildVanityURLUpdate: [guild: Guild, oldVanityURLCode: string, newVanityURLCode: string];
|
|
28
|
+
guildVanityURLRemove: [guild: Guild, vanityURLCode: string];
|
|
29
|
+
guildFeaturesUpdate: [guild: Guild, oldFeatures: GuildFeatures[], newFeatures: GuildFeatures[]];
|
|
30
|
+
guildAcronymUpdate: [oldGuild: Guild, newGuild: Guild];
|
|
31
|
+
guildOwnerUpdate: [oldGuild: Guild, newGuild: Guild];
|
|
32
|
+
guildPartnerAdd: [guild: Guild];
|
|
33
|
+
guildPartnerRemove: [guild: Guild];
|
|
34
|
+
guildVerificationAdd: [guild: Guild];
|
|
35
|
+
guildVerificationRemove: [guild: Guild];
|
|
36
|
+
messagePinned: [Message<boolean> | PartialMessage];
|
|
37
|
+
messageContentEdited: [
|
|
38
|
+
message: Message<boolean> | PartialMessage,
|
|
39
|
+
oldContent: string,
|
|
40
|
+
newContent: string
|
|
41
|
+
];
|
|
42
|
+
guildMemberOffline: [member: GuildMember, oldStatus: PresenceStatus];
|
|
43
|
+
guildMemberOnline: [member: GuildMember, newStatus: PresenceStatus];
|
|
44
|
+
rolePositionUpdate: [role: Role, oldPosition: number, newPosition: number];
|
|
45
|
+
rolePermissionsUpdate: [
|
|
46
|
+
role: Role,
|
|
47
|
+
oldPermissions: Readonly<Permissions>,
|
|
48
|
+
newPermissions: Readonly<Permissions>
|
|
49
|
+
];
|
|
50
|
+
roleIconAdd: [role: Role, iconURL: string];
|
|
51
|
+
roleIconUpdate: [role: Role, oldIconURL: string, newIconURL: string];
|
|
52
|
+
roleIconRemove: [role: Role, iconURL: string];
|
|
53
|
+
threadStateUpdate: [oldThread: ThreadChannel, newThread: ThreadChannel];
|
|
54
|
+
threadNameUpdate: [thread: ThreadChannel, oldName: string, newName: string];
|
|
55
|
+
threadLockStateUpdate: [oldThread: ThreadChannel, newThread: ThreadChannel];
|
|
56
|
+
threadRateLimitPerUserUpdate: [
|
|
57
|
+
thread: ThreadChannel,
|
|
58
|
+
oldRateLimit: number,
|
|
59
|
+
newRateLimit: number
|
|
60
|
+
];
|
|
61
|
+
threadAutoArchiveDurationUpdate: [
|
|
62
|
+
thread: ThreadChannel,
|
|
63
|
+
oldDuration: number | string,
|
|
64
|
+
newDuration: number | string
|
|
65
|
+
];
|
|
66
|
+
userAvatarUpdate: [user: User, oldAvatar: string, newAvatar: string];
|
|
67
|
+
userUsernameUpdate: [user: User, oldUsername: string, newUsername: string];
|
|
68
|
+
userDiscriminatorUpdate: [user: User, oldDiscriminator: string, newDiscriminator: string];
|
|
69
|
+
userFlagsUpdate: [user: User, oldFlags: Readonly<UserFlags>, newFlags: Readonly<UserFlags>];
|
|
70
|
+
voiceChannelJoin: [member: GuildMember, channel: VoiceBasedChannel];
|
|
71
|
+
voiceChannelSwitch: [
|
|
72
|
+
member: GuildMember,
|
|
73
|
+
oldChannel: VoiceBasedChannel,
|
|
74
|
+
newChannel: VoiceBasedChannel
|
|
75
|
+
];
|
|
76
|
+
voiceChannelLeave: [member: GuildMember, channel: VoiceBasedChannel];
|
|
77
|
+
voiceChannelMute: [member: GuildMember, type: 'self-muted' | 'server-muted'];
|
|
78
|
+
voiceChannelUnmute: [member: GuildMember, type: 'self-muted' | 'server-muted'];
|
|
79
|
+
voiceChannelDeaf: [member: GuildMember, type: 'self-deafed' | 'server-deafed'];
|
|
80
|
+
voiceChannelUndeaf: [member: GuildMember, type: 'self-deafed' | 'server-deafed'];
|
|
81
|
+
voiceStreamingStart: [member: GuildMember, channel: VoiceBasedChannel];
|
|
82
|
+
voiceStreamingStop: [member: GuildMember, channel: VoiceBasedChannel];
|
|
83
|
+
}
|
|
84
|
+
export declare type ContextOf<K extends keyof NecordEvents, E extends NecordEvents = NecordEvents> = E[K];
|