necord 5.2.0-dev.1663245459.9f9fe8c → 5.3.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/dist/commands/command.discovery.d.ts +8 -8
- package/dist/commands/command.discovery.js +13 -13
- package/dist/commands/commands.service.d.ts +14 -14
- package/dist/commands/commands.service.js +74 -74
- package/dist/commands/context-menus/context-menu.discovery.d.ts +11 -11
- package/dist/commands/context-menus/context-menu.discovery.js +19 -19
- package/dist/commands/context-menus/context-menus.service.d.ts +14 -14
- package/dist/commands/context-menus/context-menus.service.js +46 -46
- package/dist/commands/context-menus/decorators/context-menu.decorator.d.ts +2 -2
- package/dist/commands/context-menus/decorators/context-menu.decorator.js +8 -8
- package/dist/commands/context-menus/decorators/index.d.ts +4 -4
- package/dist/commands/context-menus/decorators/index.js +20 -20
- package/dist/commands/context-menus/decorators/message-command.decorator.d.ts +2 -2
- package/dist/commands/context-menus/decorators/message-command.decorator.js +7 -7
- package/dist/commands/context-menus/decorators/target.decorator.d.ts +1 -1
- package/dist/commands/context-menus/decorators/target.decorator.js +14 -14
- package/dist/commands/context-menus/decorators/user-command.decorator.d.ts +2 -2
- package/dist/commands/context-menus/decorators/user-command.decorator.js +7 -7
- package/dist/commands/context-menus/index.d.ts +3 -3
- package/dist/commands/context-menus/index.js +19 -19
- package/dist/commands/index.d.ts +4 -4
- package/dist/commands/index.js +20 -20
- package/dist/commands/slash-commands/autocomplete/autocomplete.interceptor.d.ts +7 -7
- package/dist/commands/slash-commands/autocomplete/autocomplete.interceptor.js +39 -39
- package/dist/commands/slash-commands/autocomplete/index.d.ts +1 -1
- package/dist/commands/slash-commands/autocomplete/index.js +17 -17
- package/dist/commands/slash-commands/decorators/index.d.ts +3 -3
- package/dist/commands/slash-commands/decorators/index.js +19 -19
- package/dist/commands/slash-commands/decorators/slash-command.decorator.d.ts +2 -2
- package/dist/commands/slash-commands/decorators/slash-command.decorator.js +9 -9
- package/dist/commands/slash-commands/decorators/subcommand-group.decorator.d.ts +2 -2
- package/dist/commands/slash-commands/decorators/subcommand-group.decorator.js +18 -18
- package/dist/commands/slash-commands/decorators/subcommand.decorator.d.ts +2 -2
- package/dist/commands/slash-commands/decorators/subcommand.decorator.js +9 -9
- package/dist/commands/slash-commands/index.d.ts +5 -5
- package/dist/commands/slash-commands/index.js +21 -21
- package/dist/commands/slash-commands/options/attachment-option.decorator.d.ts +7 -7
- package/dist/commands/slash-commands/options/attachment-option.decorator.js +6 -6
- package/dist/commands/slash-commands/options/boolean-option.decorator.d.ts +7 -7
- package/dist/commands/slash-commands/options/boolean-option.decorator.js +6 -6
- package/dist/commands/slash-commands/options/channel-option.decorator.d.ts +8 -8
- package/dist/commands/slash-commands/options/channel-option.decorator.js +6 -6
- package/dist/commands/slash-commands/options/index.d.ts +11 -11
- package/dist/commands/slash-commands/options/index.js +27 -27
- package/dist/commands/slash-commands/options/integer-option.decorator.d.ts +20 -20
- package/dist/commands/slash-commands/options/integer-option.decorator.js +6 -6
- package/dist/commands/slash-commands/options/member-option.decorator.d.ts +7 -7
- package/dist/commands/slash-commands/options/member-option.decorator.js +6 -6
- package/dist/commands/slash-commands/options/mentionable-option.decorator.d.ts +7 -7
- package/dist/commands/slash-commands/options/mentionable-option.decorator.js +6 -6
- package/dist/commands/slash-commands/options/number-option.decorator.d.ts +20 -20
- package/dist/commands/slash-commands/options/number-option.decorator.js +6 -6
- package/dist/commands/slash-commands/options/option.util.d.ts +5 -5
- package/dist/commands/slash-commands/options/option.util.js +21 -21
- package/dist/commands/slash-commands/options/options.decorator.d.ts +2 -2
- package/dist/commands/slash-commands/options/options.decorator.js +32 -32
- package/dist/commands/slash-commands/options/role-option.decorator.d.ts +7 -7
- package/dist/commands/slash-commands/options/role-option.decorator.js +6 -6
- package/dist/commands/slash-commands/options/string-option.decorator.d.ts +20 -20
- package/dist/commands/slash-commands/options/string-option.decorator.js +6 -6
- package/dist/commands/slash-commands/options/user-option.decorator.d.ts +7 -7
- package/dist/commands/slash-commands/options/user-option.decorator.js +6 -6
- package/dist/commands/slash-commands/slash-command.discovery.d.ts +20 -20
- package/dist/commands/slash-commands/slash-command.discovery.js +44 -44
- package/dist/commands/slash-commands/slash-commands.service.d.ts +16 -16
- package/dist/commands/slash-commands/slash-commands.service.js +77 -77
- package/dist/context/decorators/context.decorator.d.ts +2 -2
- package/dist/context/decorators/context.decorator.js +7 -7
- package/dist/context/decorators/discovery.decorator.d.ts +1 -1
- package/dist/context/decorators/discovery.decorator.js +6 -6
- package/dist/context/decorators/index.d.ts +2 -2
- package/dist/context/decorators/index.js +18 -18
- package/dist/context/decorators/params.util.d.ts +3 -3
- package/dist/context/decorators/params.util.js +12 -12
- package/dist/context/index.d.ts +7 -7
- package/dist/context/index.js +23 -23
- package/dist/context/necord-arguments-host.d.ts +13 -13
- package/dist/context/necord-arguments-host.js +22 -22
- package/dist/context/necord-base.discovery.d.ts +30 -30
- package/dist/context/necord-base.discovery.js +47 -47
- package/dist/context/necord-context.interface.d.ts +11 -11
- package/dist/context/necord-context.interface.js +2 -2
- package/dist/context/necord-execution-context.d.ts +6 -6
- package/dist/context/necord-execution-context.js +13 -13
- package/dist/context/necord-params.factory.d.ts +6 -6
- package/dist/context/necord-params.factory.js +19 -19
- package/dist/context/necord-paramtype.enum.d.ts +4 -4
- package/dist/context/necord-paramtype.enum.js +8 -8
- package/dist/index.d.ts +9 -9
- package/dist/index.js +25 -25
- package/dist/listeners/decorators/index.d.ts +3 -3
- package/dist/listeners/decorators/index.js +19 -19
- package/dist/listeners/decorators/listener.decorator.d.ts +2 -2
- package/dist/listeners/decorators/listener.decorator.js +8 -8
- package/dist/listeners/decorators/on.decorator.d.ts +2 -2
- package/dist/listeners/decorators/on.decorator.js +6 -6
- package/dist/listeners/decorators/once.decorator.d.ts +2 -2
- package/dist/listeners/decorators/once.decorator.js +6 -6
- package/dist/listeners/index.d.ts +3 -3
- package/dist/listeners/index.js +19 -19
- package/dist/listeners/listener.discovery.d.ts +11 -11
- package/dist/listeners/listener.discovery.js +19 -19
- package/dist/listeners/listener.interface.d.ts +90 -90
- package/dist/listeners/listener.interface.js +2 -2
- package/dist/listeners/listeners.service.d.ts +22 -22
- package/dist/listeners/listeners.service.js +237 -237
- package/dist/message-components/decorators/button.decorator.d.ts +1 -1
- package/dist/message-components/decorators/button.decorator.js +7 -7
- package/dist/message-components/decorators/component-param.decorator.d.ts +1 -1
- package/dist/message-components/decorators/component-param.decorator.js +17 -17
- package/dist/message-components/decorators/index.d.ts +5 -5
- package/dist/message-components/decorators/index.js +21 -21
- package/dist/message-components/decorators/message-component.decorator.d.ts +2 -2
- package/dist/message-components/decorators/message-component.decorator.js +8 -8
- package/dist/message-components/decorators/select-menu.decorator.d.ts +1 -1
- package/dist/message-components/decorators/select-menu.decorator.js +7 -7
- package/dist/message-components/decorators/values.decorator.d.ts +1 -1
- package/dist/message-components/decorators/values.decorator.js +10 -10
- package/dist/message-components/index.d.ts +3 -3
- package/dist/message-components/index.js +19 -19
- package/dist/message-components/message-component.discovery.d.ts +14 -14
- package/dist/message-components/message-component.discovery.js +27 -27
- package/dist/message-components/message-components.service.d.ts +12 -12
- package/dist/message-components/message-components.service.js +46 -46
- package/dist/modals/decorators/fields.decorator.d.ts +1 -1
- package/dist/modals/decorators/fields.decorator.js +14 -14
- package/dist/modals/decorators/index.d.ts +3 -3
- package/dist/modals/decorators/index.js +19 -19
- package/dist/modals/decorators/modal-param.decorator.d.ts +1 -1
- package/dist/modals/decorators/modal-param.decorator.js +17 -17
- package/dist/modals/decorators/modal.decorator.d.ts +1 -1
- package/dist/modals/decorators/modal.decorator.js +8 -8
- package/dist/modals/index.d.ts +3 -3
- package/dist/modals/index.js +19 -19
- package/dist/modals/modal.discovery.d.ts +12 -12
- package/dist/modals/modal.discovery.js +24 -24
- package/dist/modals/modals.service.d.ts +12 -12
- package/dist/modals/modals.service.js +46 -46
- package/dist/necord-client.provider.d.ts +3 -3
- package/dist/necord-client.provider.js +10 -10
- package/dist/necord-explorer.service.d.ts +15 -15
- package/dist/necord-explorer.service.js +59 -59
- package/dist/necord-options.interface.d.ts +16 -16
- package/dist/necord-options.interface.js +2 -2
- package/dist/necord.constants.d.ts +11 -11
- package/dist/necord.constants.js +14 -14
- package/dist/necord.module.d.ts +14 -14
- package/dist/necord.module.js +115 -115
- package/dist/text-commands/decorators/arguments.decorator.d.ts +2 -2
- package/dist/text-commands/decorators/arguments.decorator.js +14 -14
- package/dist/text-commands/decorators/index.d.ts +2 -2
- package/dist/text-commands/decorators/index.js +18 -18
- package/dist/text-commands/decorators/text-command.decorator.d.ts +2 -2
- package/dist/text-commands/decorators/text-command.decorator.js +8 -8
- package/dist/text-commands/index.d.ts +3 -3
- package/dist/text-commands/index.js +19 -19
- package/dist/text-commands/text-command.discovery.d.ts +11 -11
- package/dist/text-commands/text-command.discovery.js +19 -19
- package/dist/text-commands/text-commands.service.d.ts +14 -14
- package/dist/text-commands/text-commands.service.js +66 -66
- package/package.json +5 -5
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Args = exports.Arguments = void 0;
|
|
4
|
-
const common_1 = require("@nestjs/common");
|
|
5
|
-
const context_1 = require("../../context");
|
|
6
|
-
exports.Arguments = (0, common_1.createParamDecorator)((_, context) => {
|
|
7
|
-
const necordContext = context_1.NecordExecutionContext.create(context);
|
|
8
|
-
const [message] = necordContext.getContext();
|
|
9
|
-
const discovery = necordContext.getDiscovery();
|
|
10
|
-
if (!discovery.isTextCommand())
|
|
11
|
-
return null;
|
|
12
|
-
return message.content.split(/ +/g).slice(1);
|
|
13
|
-
});
|
|
14
|
-
exports.Args = exports.Arguments;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Args = exports.Arguments = void 0;
|
|
4
|
+
const common_1 = require("@nestjs/common");
|
|
5
|
+
const context_1 = require("../../context");
|
|
6
|
+
exports.Arguments = (0, common_1.createParamDecorator)((_, context) => {
|
|
7
|
+
const necordContext = context_1.NecordExecutionContext.create(context);
|
|
8
|
+
const [message] = necordContext.getContext();
|
|
9
|
+
const discovery = necordContext.getDiscovery();
|
|
10
|
+
if (!discovery.isTextCommand())
|
|
11
|
+
return null;
|
|
12
|
+
return message.content.split(/ +/g).slice(1);
|
|
13
|
+
});
|
|
14
|
+
exports.Args = exports.Arguments;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './arguments.decorator';
|
|
2
|
-
export * from './text-command.decorator';
|
|
1
|
+
export * from './arguments.decorator';
|
|
2
|
+
export * from './text-command.decorator';
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
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);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./arguments.decorator"), exports);
|
|
18
|
-
__exportStar(require("./text-command.decorator"), exports);
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
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);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./arguments.decorator"), exports);
|
|
18
|
+
__exportStar(require("./text-command.decorator"), exports);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { TextCommandMeta } from '../text-command.discovery';
|
|
2
|
-
export declare const TextCommand: (options: TextCommandMeta) => MethodDecorator;
|
|
1
|
+
import { TextCommandMeta } from '../text-command.discovery';
|
|
2
|
+
export declare const TextCommand: (options: TextCommandMeta) => MethodDecorator;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TextCommand = void 0;
|
|
4
|
-
const text_command_discovery_1 = require("../text-command.discovery");
|
|
5
|
-
const necord_constants_1 = require("../../necord.constants");
|
|
6
|
-
const common_1 = require("@nestjs/common");
|
|
7
|
-
const TextCommand = (options) => (0, common_1.SetMetadata)(necord_constants_1.TEXT_COMMAND_METADATA, new text_command_discovery_1.TextCommandDiscovery(options));
|
|
8
|
-
exports.TextCommand = TextCommand;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TextCommand = void 0;
|
|
4
|
+
const text_command_discovery_1 = require("../text-command.discovery");
|
|
5
|
+
const necord_constants_1 = require("../../necord.constants");
|
|
6
|
+
const common_1 = require("@nestjs/common");
|
|
7
|
+
const TextCommand = (options) => (0, common_1.SetMetadata)(necord_constants_1.TEXT_COMMAND_METADATA, new text_command_discovery_1.TextCommandDiscovery(options));
|
|
8
|
+
exports.TextCommand = TextCommand;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './decorators';
|
|
2
|
-
export * from './text-command.discovery';
|
|
3
|
-
export * from './text-commands.service';
|
|
1
|
+
export * from './decorators';
|
|
2
|
+
export * from './text-command.discovery';
|
|
3
|
+
export * from './text-commands.service';
|
|
@@ -1,19 +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
|
-
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);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./decorators"), exports);
|
|
18
|
-
__exportStar(require("./text-command.discovery"), exports);
|
|
19
|
-
__exportStar(require("./text-commands.service"), exports);
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
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);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./decorators"), exports);
|
|
18
|
+
__exportStar(require("./text-command.discovery"), exports);
|
|
19
|
+
__exportStar(require("./text-commands.service"), exports);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { NecordBaseDiscovery } from '../context';
|
|
2
|
-
export interface TextCommandMeta {
|
|
3
|
-
name: string;
|
|
4
|
-
description: string;
|
|
5
|
-
}
|
|
6
|
-
export declare class TextCommandDiscovery extends NecordBaseDiscovery<TextCommandMeta> {
|
|
7
|
-
getName(): string;
|
|
8
|
-
getDescription(): string;
|
|
9
|
-
isTextCommand(): this is TextCommandDiscovery;
|
|
10
|
-
toJSON(): Record<string, any>;
|
|
11
|
-
}
|
|
1
|
+
import { NecordBaseDiscovery } from '../context';
|
|
2
|
+
export interface TextCommandMeta {
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
}
|
|
6
|
+
export declare class TextCommandDiscovery extends NecordBaseDiscovery<TextCommandMeta> {
|
|
7
|
+
getName(): string;
|
|
8
|
+
getDescription(): string;
|
|
9
|
+
isTextCommand(): this is TextCommandDiscovery;
|
|
10
|
+
toJSON(): Record<string, any>;
|
|
11
|
+
}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TextCommandDiscovery = void 0;
|
|
4
|
-
const context_1 = require("../context");
|
|
5
|
-
class TextCommandDiscovery extends context_1.NecordBaseDiscovery {
|
|
6
|
-
getName() {
|
|
7
|
-
return this.meta.name;
|
|
8
|
-
}
|
|
9
|
-
getDescription() {
|
|
10
|
-
return this.meta.description;
|
|
11
|
-
}
|
|
12
|
-
isTextCommand() {
|
|
13
|
-
return true;
|
|
14
|
-
}
|
|
15
|
-
toJSON() {
|
|
16
|
-
return this.meta;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
exports.TextCommandDiscovery = TextCommandDiscovery;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TextCommandDiscovery = void 0;
|
|
4
|
+
const context_1 = require("../context");
|
|
5
|
+
class TextCommandDiscovery extends context_1.NecordBaseDiscovery {
|
|
6
|
+
getName() {
|
|
7
|
+
return this.meta.name;
|
|
8
|
+
}
|
|
9
|
+
getDescription() {
|
|
10
|
+
return this.meta.description;
|
|
11
|
+
}
|
|
12
|
+
isTextCommand() {
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
15
|
+
toJSON() {
|
|
16
|
+
return this.meta;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.TextCommandDiscovery = TextCommandDiscovery;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { OnApplicationBootstrap, OnModuleInit } from '@nestjs/common';
|
|
2
|
-
import { Client } from 'discord.js';
|
|
3
|
-
import { TextCommandDiscovery } from './text-command.discovery';
|
|
4
|
-
import { ExplorerService } from '../necord-explorer.service';
|
|
5
|
-
import { NecordModuleOptions } from '../necord-options.interface';
|
|
6
|
-
export declare class TextCommandsService implements OnModuleInit, OnApplicationBootstrap {
|
|
7
|
-
private readonly options;
|
|
8
|
-
private readonly client;
|
|
9
|
-
private readonly explorerService;
|
|
10
|
-
private readonly textCommands;
|
|
11
|
-
constructor(options: NecordModuleOptions, client: Client, explorerService: ExplorerService<TextCommandDiscovery>);
|
|
12
|
-
onModuleInit(): void;
|
|
13
|
-
onApplicationBootstrap(): Client<boolean>;
|
|
14
|
-
}
|
|
1
|
+
import { OnApplicationBootstrap, OnModuleInit } from '@nestjs/common';
|
|
2
|
+
import { Client } from 'discord.js';
|
|
3
|
+
import { TextCommandDiscovery } from './text-command.discovery';
|
|
4
|
+
import { ExplorerService } from '../necord-explorer.service';
|
|
5
|
+
import { NecordModuleOptions } from '../necord-options.interface';
|
|
6
|
+
export declare class TextCommandsService implements OnModuleInit, OnApplicationBootstrap {
|
|
7
|
+
private readonly options;
|
|
8
|
+
private readonly client;
|
|
9
|
+
private readonly explorerService;
|
|
10
|
+
private readonly textCommands;
|
|
11
|
+
constructor(options: NecordModuleOptions, client: Client, explorerService: ExplorerService<TextCommandDiscovery>);
|
|
12
|
+
onModuleInit(): void;
|
|
13
|
+
onApplicationBootstrap(): Client<boolean>;
|
|
14
|
+
}
|
|
@@ -1,66 +1,66 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
-
};
|
|
14
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
15
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
16
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
17
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
18
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
19
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
20
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
21
|
-
});
|
|
22
|
-
};
|
|
23
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
-
exports.TextCommandsService = void 0;
|
|
25
|
-
const common_1 = require("@nestjs/common");
|
|
26
|
-
const discord_js_1 = require("discord.js");
|
|
27
|
-
const necord_constants_1 = require("../necord.constants");
|
|
28
|
-
const necord_explorer_service_1 = require("../necord-explorer.service");
|
|
29
|
-
let TextCommandsService = class TextCommandsService {
|
|
30
|
-
constructor(options, client, explorerService) {
|
|
31
|
-
this.options = options;
|
|
32
|
-
this.client = client;
|
|
33
|
-
this.explorerService = explorerService;
|
|
34
|
-
this.textCommands = new Map();
|
|
35
|
-
}
|
|
36
|
-
onModuleInit() {
|
|
37
|
-
return this.explorerService
|
|
38
|
-
.explore(necord_constants_1.TEXT_COMMAND_METADATA)
|
|
39
|
-
.forEach(textCommand => this.textCommands.set(textCommand.getName(), textCommand));
|
|
40
|
-
}
|
|
41
|
-
onApplicationBootstrap() {
|
|
42
|
-
return this.client.on('messageCreate', (message) => __awaiter(this, void 0, void 0, function* () {
|
|
43
|
-
var _a, _b, _c;
|
|
44
|
-
if (!message || !((_a = message.content) === null || _a === void 0 ? void 0 : _a.length) || message.webhookId || message.author.bot)
|
|
45
|
-
return;
|
|
46
|
-
const content = message.content.toLowerCase();
|
|
47
|
-
const prefix = typeof this.options.prefix !== 'function'
|
|
48
|
-
? (_b = this.options.prefix) !== null && _b !== void 0 ? _b : '!'
|
|
49
|
-
: yield this.options.prefix(message);
|
|
50
|
-
if (!prefix || !content.startsWith(prefix))
|
|
51
|
-
return;
|
|
52
|
-
const args = content.substring(prefix.length).split(/ +/g);
|
|
53
|
-
const cmd = args.shift();
|
|
54
|
-
if (!cmd)
|
|
55
|
-
return;
|
|
56
|
-
return (_c = this.textCommands.get(cmd)) === null || _c === void 0 ? void 0 : _c.execute([message]);
|
|
57
|
-
}));
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
TextCommandsService = __decorate([
|
|
61
|
-
(0, common_1.Injectable)(),
|
|
62
|
-
__param(0, (0, common_1.Inject)(necord_constants_1.NECORD_MODULE_OPTIONS)),
|
|
63
|
-
__metadata("design:paramtypes", [Object, discord_js_1.Client,
|
|
64
|
-
necord_explorer_service_1.ExplorerService])
|
|
65
|
-
], TextCommandsService);
|
|
66
|
-
exports.TextCommandsService = TextCommandsService;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
15
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
16
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
17
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
18
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
19
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
20
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
exports.TextCommandsService = void 0;
|
|
25
|
+
const common_1 = require("@nestjs/common");
|
|
26
|
+
const discord_js_1 = require("discord.js");
|
|
27
|
+
const necord_constants_1 = require("../necord.constants");
|
|
28
|
+
const necord_explorer_service_1 = require("../necord-explorer.service");
|
|
29
|
+
let TextCommandsService = class TextCommandsService {
|
|
30
|
+
constructor(options, client, explorerService) {
|
|
31
|
+
this.options = options;
|
|
32
|
+
this.client = client;
|
|
33
|
+
this.explorerService = explorerService;
|
|
34
|
+
this.textCommands = new Map();
|
|
35
|
+
}
|
|
36
|
+
onModuleInit() {
|
|
37
|
+
return this.explorerService
|
|
38
|
+
.explore(necord_constants_1.TEXT_COMMAND_METADATA)
|
|
39
|
+
.forEach(textCommand => this.textCommands.set(textCommand.getName(), textCommand));
|
|
40
|
+
}
|
|
41
|
+
onApplicationBootstrap() {
|
|
42
|
+
return this.client.on('messageCreate', (message) => __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
var _a, _b, _c;
|
|
44
|
+
if (!message || !((_a = message.content) === null || _a === void 0 ? void 0 : _a.length) || message.webhookId || message.author.bot)
|
|
45
|
+
return;
|
|
46
|
+
const content = message.content.toLowerCase();
|
|
47
|
+
const prefix = typeof this.options.prefix !== 'function'
|
|
48
|
+
? (_b = this.options.prefix) !== null && _b !== void 0 ? _b : '!'
|
|
49
|
+
: yield this.options.prefix(message);
|
|
50
|
+
if (!prefix || !content.startsWith(prefix))
|
|
51
|
+
return;
|
|
52
|
+
const args = content.substring(prefix.length).split(/ +/g);
|
|
53
|
+
const cmd = args.shift();
|
|
54
|
+
if (!cmd)
|
|
55
|
+
return;
|
|
56
|
+
return (_c = this.textCommands.get(cmd)) === null || _c === void 0 ? void 0 : _c.execute([message]);
|
|
57
|
+
}));
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
TextCommandsService = __decorate([
|
|
61
|
+
(0, common_1.Injectable)(),
|
|
62
|
+
__param(0, (0, common_1.Inject)(necord_constants_1.NECORD_MODULE_OPTIONS)),
|
|
63
|
+
__metadata("design:paramtypes", [Object, discord_js_1.Client,
|
|
64
|
+
necord_explorer_service_1.ExplorerService])
|
|
65
|
+
], TextCommandsService);
|
|
66
|
+
exports.TextCommandsService = TextCommandsService;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "necord",
|
|
3
3
|
"description": "A module for creating Discord bots using NestJS, based on Discord.js.",
|
|
4
|
-
"version": "5.
|
|
4
|
+
"version": "5.3.0",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "rimraf -rf dist && tsc -p tsconfig.json",
|
|
7
7
|
"prepublish:npm": "npm run build",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"@types/node": "18.7.18",
|
|
60
60
|
"@typescript-eslint/eslint-plugin": "5.37.0",
|
|
61
61
|
"@typescript-eslint/parser": "5.37.0",
|
|
62
|
-
"discord-api-types": "0.37.
|
|
62
|
+
"discord-api-types": "0.37.10",
|
|
63
63
|
"discord.js": "14.3.0",
|
|
64
64
|
"eslint": "8.23.1",
|
|
65
65
|
"eslint-config-prettier": "8.5.0",
|
|
@@ -69,15 +69,15 @@
|
|
|
69
69
|
"lint-staged": "13.0.3",
|
|
70
70
|
"prettier": "2.7.1",
|
|
71
71
|
"reflect-metadata": "0.1.13",
|
|
72
|
-
"release-it": "15.4.
|
|
72
|
+
"release-it": "15.4.2",
|
|
73
73
|
"rimraf": "3.0.2",
|
|
74
74
|
"rxjs": "7.5.6",
|
|
75
75
|
"ts-node": "10.9.1",
|
|
76
76
|
"typescript": "4.8.3"
|
|
77
77
|
},
|
|
78
78
|
"peerDependencies": {
|
|
79
|
-
"@nestjs/common": "^8.0.0",
|
|
80
|
-
"@nestjs/core": "^8.0.0",
|
|
79
|
+
"@nestjs/common": "^8.0.0 || ^9.0.0",
|
|
80
|
+
"@nestjs/core": "^8.0.0 || ^9.0.0",
|
|
81
81
|
"discord.js": "^14.0.1",
|
|
82
82
|
"reflect-metadata": "^0.1.13",
|
|
83
83
|
"rxjs": "^7.2.0"
|