necord 5.4.2 → 5.4.4
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 +15 -15
- package/dist/commands/commands.service.js +80 -80
- 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 +16 -16
- package/dist/commands/context-menus/context-menus.service.js +52 -52
- 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 +7 -7
- package/dist/commands/context-menus/decorators/target.decorator.js +38 -38
- 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 +19 -19
- package/dist/commands/slash-commands/slash-commands.service.js +84 -84
- 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 +22 -22
- 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 +6 -6
- package/dist/message-components/decorators/index.js +22 -22
- 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 +12 -12
- package/dist/message-components/decorators/select-menu.decorator.js +23 -23
- package/dist/message-components/decorators/selected.decorator.d.ts +10 -10
- package/dist/message-components/decorators/selected.decorator.js +40 -39
- package/dist/message-components/decorators/values.decorator.d.ts +7 -7
- package/dist/message-components/decorators/values.decorator.js +17 -17
- 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 +15 -15
- package/dist/message-components/message-components.service.js +55 -55
- 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 +14 -14
- package/dist/modals/modals.service.js +50 -50
- 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 +17 -17
- 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 +123 -123
- 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 +16 -16
- package/dist/text-commands/text-commands.service.js +72 -72
- package/package.json +8 -8
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { BaseApplicationCommandData, Snowflake } from 'discord.js';
|
|
2
|
-
import { NecordBaseDiscovery } from '../context';
|
|
3
|
-
export declare abstract class CommandDiscovery<T extends BaseApplicationCommandData & {
|
|
4
|
-
guilds?: Snowflake[];
|
|
5
|
-
} = BaseApplicationCommandData> extends NecordBaseDiscovery<T> {
|
|
6
|
-
getName(): string;
|
|
7
|
-
getGuilds(): Snowflake[];
|
|
8
|
-
}
|
|
1
|
+
import { BaseApplicationCommandData, Snowflake } from 'discord.js';
|
|
2
|
+
import { NecordBaseDiscovery } from '../context';
|
|
3
|
+
export declare abstract class CommandDiscovery<T extends BaseApplicationCommandData & {
|
|
4
|
+
guilds?: Snowflake[];
|
|
5
|
+
} = BaseApplicationCommandData> extends NecordBaseDiscovery<T> {
|
|
6
|
+
getName(): string;
|
|
7
|
+
getGuilds(): Snowflake[];
|
|
8
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CommandDiscovery = void 0;
|
|
4
|
-
const context_1 = require("../context");
|
|
5
|
-
class CommandDiscovery extends context_1.NecordBaseDiscovery {
|
|
6
|
-
getName() {
|
|
7
|
-
return this.meta.name;
|
|
8
|
-
}
|
|
9
|
-
getGuilds() {
|
|
10
|
-
return this.meta.guilds;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
exports.CommandDiscovery = CommandDiscovery;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CommandDiscovery = void 0;
|
|
4
|
+
const context_1 = require("../context");
|
|
5
|
+
class CommandDiscovery extends context_1.NecordBaseDiscovery {
|
|
6
|
+
getName() {
|
|
7
|
+
return this.meta.name;
|
|
8
|
+
}
|
|
9
|
+
getGuilds() {
|
|
10
|
+
return this.meta.guilds;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.CommandDiscovery = CommandDiscovery;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { OnModuleInit } from '@nestjs/common';
|
|
2
|
-
import { Client } from 'discord.js';
|
|
3
|
-
import { NecordModuleOptions } from '../necord-options.interface';
|
|
4
|
-
import { ContextMenusService } from './context-menus';
|
|
5
|
-
import { SlashCommandsService } from './slash-commands';
|
|
6
|
-
export declare class CommandsService implements OnModuleInit {
|
|
7
|
-
private readonly client;
|
|
8
|
-
private readonly options;
|
|
9
|
-
private readonly contextMenusService;
|
|
10
|
-
private readonly slashCommandsService;
|
|
11
|
-
private readonly logger;
|
|
12
|
-
constructor(client: Client, options: NecordModuleOptions, contextMenusService: ContextMenusService, slashCommandsService: SlashCommandsService);
|
|
13
|
-
onModuleInit(): Client<boolean>;
|
|
14
|
-
register(client: Client): Promise<void>;
|
|
15
|
-
}
|
|
1
|
+
import { OnModuleInit } from '@nestjs/common';
|
|
2
|
+
import { Client } from 'discord.js';
|
|
3
|
+
import { NecordModuleOptions } from '../necord-options.interface';
|
|
4
|
+
import { ContextMenusService } from './context-menus';
|
|
5
|
+
import { SlashCommandsService } from './slash-commands';
|
|
6
|
+
export declare class CommandsService implements OnModuleInit {
|
|
7
|
+
private readonly client;
|
|
8
|
+
private readonly options;
|
|
9
|
+
private readonly contextMenusService;
|
|
10
|
+
private readonly slashCommandsService;
|
|
11
|
+
private readonly logger;
|
|
12
|
+
constructor(client: Client, options: NecordModuleOptions, contextMenusService: ContextMenusService, slashCommandsService: SlashCommandsService);
|
|
13
|
+
onModuleInit(): Client<boolean>;
|
|
14
|
+
register(client: Client): Promise<void>;
|
|
15
|
+
}
|
|
@@ -1,80 +1,80 @@
|
|
|
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
|
-
var CommandsService_1;
|
|
24
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.CommandsService = void 0;
|
|
26
|
-
const common_1 = require("@nestjs/common");
|
|
27
|
-
const necord_constants_1 = require("../necord.constants");
|
|
28
|
-
const discord_js_1 = require("discord.js");
|
|
29
|
-
const context_menus_1 = require("./context-menus");
|
|
30
|
-
const slash_commands_1 = require("./slash-commands");
|
|
31
|
-
let CommandsService = CommandsService_1 = class CommandsService {
|
|
32
|
-
constructor(client, options, contextMenusService, slashCommandsService) {
|
|
33
|
-
this.client = client;
|
|
34
|
-
this.options = options;
|
|
35
|
-
this.contextMenusService = contextMenusService;
|
|
36
|
-
this.slashCommandsService = slashCommandsService;
|
|
37
|
-
this.logger = new common_1.Logger(CommandsService_1.name);
|
|
38
|
-
}
|
|
39
|
-
onModuleInit() {
|
|
40
|
-
if (this.options.skipRegistration) {
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
return this.client.once('ready', (client) => __awaiter(this, void 0, void 0, function* () { return this.register(client); }));
|
|
44
|
-
}
|
|
45
|
-
register(client) {
|
|
46
|
-
var _a, _b;
|
|
47
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
48
|
-
if (client.application.partial) {
|
|
49
|
-
yield client.application.fetch();
|
|
50
|
-
}
|
|
51
|
-
const clientCommands = client.application.commands;
|
|
52
|
-
const commands = [
|
|
53
|
-
...this.contextMenusService.getCommands(),
|
|
54
|
-
...this.slashCommandsService.getCommands()
|
|
55
|
-
];
|
|
56
|
-
const commandsByGuildMap = new Map([[undefined, []]]);
|
|
57
|
-
for (const command of commands) {
|
|
58
|
-
const guilds = Array.isArray(this.options.development)
|
|
59
|
-
? this.options.development
|
|
60
|
-
: (_a = command.getGuilds()) !== null && _a !== void 0 ? _a : [undefined];
|
|
61
|
-
for (const guildId of guilds) {
|
|
62
|
-
const visitedCommands = (_b = commandsByGuildMap.get(guildId)) !== null && _b !== void 0 ? _b : [];
|
|
63
|
-
commandsByGuildMap.set(guildId, visitedCommands.concat(command));
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
this.logger.log(`Started refreshing application commands.`);
|
|
67
|
-
for (const [guild, commands] of commandsByGuildMap) {
|
|
68
|
-
yield clientCommands.set(commands.flatMap(command => command.toJSON()), guild);
|
|
69
|
-
}
|
|
70
|
-
this.logger.log(`Successfully reloaded application commands.`);
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
CommandsService = CommandsService_1 = __decorate([
|
|
75
|
-
(0, common_1.Injectable)(),
|
|
76
|
-
__param(1, (0, common_1.Inject)(necord_constants_1.NECORD_MODULE_OPTIONS)),
|
|
77
|
-
__metadata("design:paramtypes", [discord_js_1.Client, Object, context_menus_1.ContextMenusService,
|
|
78
|
-
slash_commands_1.SlashCommandsService])
|
|
79
|
-
], CommandsService);
|
|
80
|
-
exports.CommandsService = CommandsService;
|
|
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
|
+
var CommandsService_1;
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.CommandsService = void 0;
|
|
26
|
+
const common_1 = require("@nestjs/common");
|
|
27
|
+
const necord_constants_1 = require("../necord.constants");
|
|
28
|
+
const discord_js_1 = require("discord.js");
|
|
29
|
+
const context_menus_1 = require("./context-menus");
|
|
30
|
+
const slash_commands_1 = require("./slash-commands");
|
|
31
|
+
let CommandsService = CommandsService_1 = class CommandsService {
|
|
32
|
+
constructor(client, options, contextMenusService, slashCommandsService) {
|
|
33
|
+
this.client = client;
|
|
34
|
+
this.options = options;
|
|
35
|
+
this.contextMenusService = contextMenusService;
|
|
36
|
+
this.slashCommandsService = slashCommandsService;
|
|
37
|
+
this.logger = new common_1.Logger(CommandsService_1.name);
|
|
38
|
+
}
|
|
39
|
+
onModuleInit() {
|
|
40
|
+
if (this.options.skipRegistration) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
return this.client.once('ready', (client) => __awaiter(this, void 0, void 0, function* () { return this.register(client); }));
|
|
44
|
+
}
|
|
45
|
+
register(client) {
|
|
46
|
+
var _a, _b;
|
|
47
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
48
|
+
if (client.application.partial) {
|
|
49
|
+
yield client.application.fetch();
|
|
50
|
+
}
|
|
51
|
+
const clientCommands = client.application.commands;
|
|
52
|
+
const commands = [
|
|
53
|
+
...this.contextMenusService.getCommands(),
|
|
54
|
+
...this.slashCommandsService.getCommands()
|
|
55
|
+
];
|
|
56
|
+
const commandsByGuildMap = new Map([[undefined, []]]);
|
|
57
|
+
for (const command of commands) {
|
|
58
|
+
const guilds = Array.isArray(this.options.development)
|
|
59
|
+
? this.options.development
|
|
60
|
+
: (_a = command.getGuilds()) !== null && _a !== void 0 ? _a : [undefined];
|
|
61
|
+
for (const guildId of guilds) {
|
|
62
|
+
const visitedCommands = (_b = commandsByGuildMap.get(guildId)) !== null && _b !== void 0 ? _b : [];
|
|
63
|
+
commandsByGuildMap.set(guildId, visitedCommands.concat(command));
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
this.logger.log(`Started refreshing application commands.`);
|
|
67
|
+
for (const [guild, commands] of commandsByGuildMap) {
|
|
68
|
+
yield clientCommands.set(commands.flatMap(command => command.toJSON()), guild);
|
|
69
|
+
}
|
|
70
|
+
this.logger.log(`Successfully reloaded application commands.`);
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
CommandsService = CommandsService_1 = __decorate([
|
|
75
|
+
(0, common_1.Injectable)(),
|
|
76
|
+
__param(1, (0, common_1.Inject)(necord_constants_1.NECORD_MODULE_OPTIONS)),
|
|
77
|
+
__metadata("design:paramtypes", [discord_js_1.Client, Object, context_menus_1.ContextMenusService,
|
|
78
|
+
slash_commands_1.SlashCommandsService])
|
|
79
|
+
], CommandsService);
|
|
80
|
+
exports.CommandsService = CommandsService;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { ContextMenuCommandInteraction, MessageApplicationCommandData, Snowflake, UserApplicationCommandData } from 'discord.js';
|
|
2
|
-
import { CommandDiscovery } from '../command.discovery';
|
|
3
|
-
export type ContextMenuMeta = (MessageApplicationCommandData | UserApplicationCommandData) & {
|
|
4
|
-
guilds?: Snowflake[];
|
|
5
|
-
};
|
|
6
|
-
export declare class ContextMenuDiscovery extends CommandDiscovery<ContextMenuMeta> {
|
|
7
|
-
getType(): import("discord.js").ApplicationCommandType.User | import("discord.js").ApplicationCommandType.Message;
|
|
8
|
-
isContextMenu(): this is ContextMenuDiscovery;
|
|
9
|
-
execute(interaction: ContextMenuCommandInteraction): any;
|
|
10
|
-
toJSON(): ContextMenuMeta;
|
|
11
|
-
}
|
|
1
|
+
import { ContextMenuCommandInteraction, MessageApplicationCommandData, Snowflake, UserApplicationCommandData } from 'discord.js';
|
|
2
|
+
import { CommandDiscovery } from '../command.discovery';
|
|
3
|
+
export type ContextMenuMeta = (MessageApplicationCommandData | UserApplicationCommandData) & {
|
|
4
|
+
guilds?: Snowflake[];
|
|
5
|
+
};
|
|
6
|
+
export declare class ContextMenuDiscovery extends CommandDiscovery<ContextMenuMeta> {
|
|
7
|
+
getType(): import("discord.js").ApplicationCommandType.User | import("discord.js").ApplicationCommandType.Message;
|
|
8
|
+
isContextMenu(): this is ContextMenuDiscovery;
|
|
9
|
+
execute(interaction: ContextMenuCommandInteraction): any;
|
|
10
|
+
toJSON(): ContextMenuMeta;
|
|
11
|
+
}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ContextMenuDiscovery = void 0;
|
|
4
|
-
const command_discovery_1 = require("../command.discovery");
|
|
5
|
-
class ContextMenuDiscovery extends command_discovery_1.CommandDiscovery {
|
|
6
|
-
getType() {
|
|
7
|
-
return this.meta.type;
|
|
8
|
-
}
|
|
9
|
-
isContextMenu() {
|
|
10
|
-
return true;
|
|
11
|
-
}
|
|
12
|
-
execute(interaction) {
|
|
13
|
-
return super.execute([interaction]);
|
|
14
|
-
}
|
|
15
|
-
toJSON() {
|
|
16
|
-
return this.meta;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
exports.ContextMenuDiscovery = ContextMenuDiscovery;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ContextMenuDiscovery = void 0;
|
|
4
|
+
const command_discovery_1 = require("../command.discovery");
|
|
5
|
+
class ContextMenuDiscovery extends command_discovery_1.CommandDiscovery {
|
|
6
|
+
getType() {
|
|
7
|
+
return this.meta.type;
|
|
8
|
+
}
|
|
9
|
+
isContextMenu() {
|
|
10
|
+
return true;
|
|
11
|
+
}
|
|
12
|
+
execute(interaction) {
|
|
13
|
+
return super.execute([interaction]);
|
|
14
|
+
}
|
|
15
|
+
toJSON() {
|
|
16
|
+
return this.meta;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.ContextMenuDiscovery = ContextMenuDiscovery;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { OnApplicationBootstrap, OnModuleInit } from '@nestjs/common';
|
|
2
|
-
import { ContextMenuDiscovery, ContextMenuMeta } from './context-menu.discovery';
|
|
3
|
-
import { Client } from 'discord.js';
|
|
4
|
-
import { ExplorerService } from '../../necord-explorer.service';
|
|
5
|
-
import { CommandDiscovery } from '../command.discovery';
|
|
6
|
-
export declare class ContextMenusService implements OnModuleInit, OnApplicationBootstrap {
|
|
7
|
-
private readonly client;
|
|
8
|
-
private readonly explorerService;
|
|
9
|
-
private readonly contextMenus;
|
|
10
|
-
constructor(client: Client, explorerService: ExplorerService<ContextMenuDiscovery>);
|
|
11
|
-
onModuleInit(): void;
|
|
12
|
-
onApplicationBootstrap(): Client<boolean>;
|
|
13
|
-
getCommands(): CommandDiscovery[];
|
|
14
|
-
add(contextMenu: ContextMenuDiscovery): void;
|
|
15
|
-
remove(type: ContextMenuMeta['type'], name: ContextMenuMeta['name']): boolean;
|
|
16
|
-
}
|
|
1
|
+
import { OnApplicationBootstrap, OnModuleInit } from '@nestjs/common';
|
|
2
|
+
import { ContextMenuDiscovery, ContextMenuMeta } from './context-menu.discovery';
|
|
3
|
+
import { Client } from 'discord.js';
|
|
4
|
+
import { ExplorerService } from '../../necord-explorer.service';
|
|
5
|
+
import { CommandDiscovery } from '../command.discovery';
|
|
6
|
+
export declare class ContextMenusService implements OnModuleInit, OnApplicationBootstrap {
|
|
7
|
+
private readonly client;
|
|
8
|
+
private readonly explorerService;
|
|
9
|
+
private readonly contextMenus;
|
|
10
|
+
constructor(client: Client, explorerService: ExplorerService<ContextMenuDiscovery>);
|
|
11
|
+
onModuleInit(): void;
|
|
12
|
+
onApplicationBootstrap(): Client<boolean>;
|
|
13
|
+
getCommands(): CommandDiscovery[];
|
|
14
|
+
add(contextMenu: ContextMenuDiscovery): void;
|
|
15
|
+
remove(type: ContextMenuMeta['type'], name: ContextMenuMeta['name']): boolean;
|
|
16
|
+
}
|
|
@@ -1,52 +1,52 @@
|
|
|
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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.ContextMenusService = void 0;
|
|
13
|
-
const common_1 = require("@nestjs/common");
|
|
14
|
-
const discord_js_1 = require("discord.js");
|
|
15
|
-
const necord_constants_1 = require("../../necord.constants");
|
|
16
|
-
const necord_explorer_service_1 = require("../../necord-explorer.service");
|
|
17
|
-
let ContextMenusService = class ContextMenusService {
|
|
18
|
-
constructor(client, explorerService) {
|
|
19
|
-
this.client = client;
|
|
20
|
-
this.explorerService = explorerService;
|
|
21
|
-
this.contextMenus = new Map();
|
|
22
|
-
}
|
|
23
|
-
onModuleInit() {
|
|
24
|
-
return this.explorerService
|
|
25
|
-
.explore(necord_constants_1.CONTEXT_MENU_METADATA)
|
|
26
|
-
.forEach(contextMenu => this.add(contextMenu));
|
|
27
|
-
}
|
|
28
|
-
onApplicationBootstrap() {
|
|
29
|
-
return this.client.on('interactionCreate', interaction => {
|
|
30
|
-
var _a;
|
|
31
|
-
if (!interaction.isContextMenuCommand())
|
|
32
|
-
return;
|
|
33
|
-
return (_a = this.contextMenus
|
|
34
|
-
.get(interaction.commandType.toString().concat(':', interaction.commandName))) === null || _a === void 0 ? void 0 : _a.execute(interaction);
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
getCommands() {
|
|
38
|
-
return [...this.contextMenus.values()];
|
|
39
|
-
}
|
|
40
|
-
add(contextMenu) {
|
|
41
|
-
this.contextMenus.set(contextMenu.getType().toString().concat(':', contextMenu.getName()), contextMenu);
|
|
42
|
-
}
|
|
43
|
-
remove(type, name) {
|
|
44
|
-
return this.contextMenus.delete(type.toString().concat(':', name));
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
ContextMenusService = __decorate([
|
|
48
|
-
(0, common_1.Injectable)(),
|
|
49
|
-
__metadata("design:paramtypes", [discord_js_1.Client,
|
|
50
|
-
necord_explorer_service_1.ExplorerService])
|
|
51
|
-
], ContextMenusService);
|
|
52
|
-
exports.ContextMenusService = ContextMenusService;
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ContextMenusService = void 0;
|
|
13
|
+
const common_1 = require("@nestjs/common");
|
|
14
|
+
const discord_js_1 = require("discord.js");
|
|
15
|
+
const necord_constants_1 = require("../../necord.constants");
|
|
16
|
+
const necord_explorer_service_1 = require("../../necord-explorer.service");
|
|
17
|
+
let ContextMenusService = class ContextMenusService {
|
|
18
|
+
constructor(client, explorerService) {
|
|
19
|
+
this.client = client;
|
|
20
|
+
this.explorerService = explorerService;
|
|
21
|
+
this.contextMenus = new Map();
|
|
22
|
+
}
|
|
23
|
+
onModuleInit() {
|
|
24
|
+
return this.explorerService
|
|
25
|
+
.explore(necord_constants_1.CONTEXT_MENU_METADATA)
|
|
26
|
+
.forEach(contextMenu => this.add(contextMenu));
|
|
27
|
+
}
|
|
28
|
+
onApplicationBootstrap() {
|
|
29
|
+
return this.client.on('interactionCreate', interaction => {
|
|
30
|
+
var _a;
|
|
31
|
+
if (!interaction.isContextMenuCommand())
|
|
32
|
+
return;
|
|
33
|
+
return (_a = this.contextMenus
|
|
34
|
+
.get(interaction.commandType.toString().concat(':', interaction.commandName))) === null || _a === void 0 ? void 0 : _a.execute(interaction);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
getCommands() {
|
|
38
|
+
return [...this.contextMenus.values()];
|
|
39
|
+
}
|
|
40
|
+
add(contextMenu) {
|
|
41
|
+
this.contextMenus.set(contextMenu.getType().toString().concat(':', contextMenu.getName()), contextMenu);
|
|
42
|
+
}
|
|
43
|
+
remove(type, name) {
|
|
44
|
+
return this.contextMenus.delete(type.toString().concat(':', name));
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
ContextMenusService = __decorate([
|
|
48
|
+
(0, common_1.Injectable)(),
|
|
49
|
+
__metadata("design:paramtypes", [discord_js_1.Client,
|
|
50
|
+
necord_explorer_service_1.ExplorerService])
|
|
51
|
+
], ContextMenusService);
|
|
52
|
+
exports.ContextMenusService = ContextMenusService;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ContextMenuMeta } from '../context-menu.discovery';
|
|
2
|
-
export declare const ContextMenu: (options: ContextMenuMeta) => import("@nestjs/common").CustomDecorator<string>;
|
|
1
|
+
import { ContextMenuMeta } from '../context-menu.discovery';
|
|
2
|
+
export declare const ContextMenu: (options: ContextMenuMeta) => import("@nestjs/common").CustomDecorator<string>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ContextMenu = void 0;
|
|
4
|
-
const context_menu_discovery_1 = require("../context-menu.discovery");
|
|
5
|
-
const common_1 = require("@nestjs/common");
|
|
6
|
-
const necord_constants_1 = require("../../../necord.constants");
|
|
7
|
-
const ContextMenu = (options) => (0, common_1.SetMetadata)(necord_constants_1.CONTEXT_MENU_METADATA, new context_menu_discovery_1.ContextMenuDiscovery(options));
|
|
8
|
-
exports.ContextMenu = ContextMenu;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ContextMenu = void 0;
|
|
4
|
+
const context_menu_discovery_1 = require("../context-menu.discovery");
|
|
5
|
+
const common_1 = require("@nestjs/common");
|
|
6
|
+
const necord_constants_1 = require("../../../necord.constants");
|
|
7
|
+
const ContextMenu = (options) => (0, common_1.SetMetadata)(necord_constants_1.CONTEXT_MENU_METADATA, new context_menu_discovery_1.ContextMenuDiscovery(options));
|
|
8
|
+
exports.ContextMenu = ContextMenu;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './context-menu.decorator';
|
|
2
|
-
export * from './message-command.decorator';
|
|
3
|
-
export * from './user-command.decorator';
|
|
4
|
-
export * from './target.decorator';
|
|
1
|
+
export * from './context-menu.decorator';
|
|
2
|
+
export * from './message-command.decorator';
|
|
3
|
+
export * from './user-command.decorator';
|
|
4
|
+
export * from './target.decorator';
|
|
@@ -1,20 +1,20 @@
|
|
|
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("./context-menu.decorator"), exports);
|
|
18
|
-
__exportStar(require("./message-command.decorator"), exports);
|
|
19
|
-
__exportStar(require("./user-command.decorator"), exports);
|
|
20
|
-
__exportStar(require("./target.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("./context-menu.decorator"), exports);
|
|
18
|
+
__exportStar(require("./message-command.decorator"), exports);
|
|
19
|
+
__exportStar(require("./user-command.decorator"), exports);
|
|
20
|
+
__exportStar(require("./target.decorator"), exports);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ContextMenuMeta } from '../context-menu.discovery';
|
|
2
|
-
export declare const MessageCommand: (options: Omit<ContextMenuMeta, 'type'>) => import("@nestjs/common").CustomDecorator<string>;
|
|
1
|
+
import { ContextMenuMeta } from '../context-menu.discovery';
|
|
2
|
+
export declare const MessageCommand: (options: Omit<ContextMenuMeta, 'type'>) => import("@nestjs/common").CustomDecorator<string>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MessageCommand = void 0;
|
|
4
|
-
const discord_js_1 = require("discord.js");
|
|
5
|
-
const context_menu_decorator_1 = require("./context-menu.decorator");
|
|
6
|
-
const MessageCommand = (options) => (0, context_menu_decorator_1.ContextMenu)(Object.assign({ type: discord_js_1.ApplicationCommandType.Message }, options));
|
|
7
|
-
exports.MessageCommand = MessageCommand;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MessageCommand = void 0;
|
|
4
|
+
const discord_js_1 = require("discord.js");
|
|
5
|
+
const context_menu_decorator_1 = require("./context-menu.decorator");
|
|
6
|
+
const MessageCommand = (options) => (0, context_menu_decorator_1.ContextMenu)(Object.assign({ type: discord_js_1.ApplicationCommandType.Message }, options));
|
|
7
|
+
exports.MessageCommand = MessageCommand;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @deprecated Use `@TargetMessage`, `@TargetUser` or `@TargetMember` instead
|
|
3
|
-
*/
|
|
4
|
-
export declare const Target: (...dataOrPipes: any[]) => ParameterDecorator;
|
|
5
|
-
export declare const TargetMessage: (...dataOrPipes: any[]) => ParameterDecorator;
|
|
6
|
-
export declare const TargetUser: (...dataOrPipes: any[]) => ParameterDecorator;
|
|
7
|
-
export declare const TargetMember: (...dataOrPipes: any[]) => ParameterDecorator;
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated Use `@TargetMessage`, `@TargetUser` or `@TargetMember` instead
|
|
3
|
+
*/
|
|
4
|
+
export declare const Target: (...dataOrPipes: any[]) => ParameterDecorator;
|
|
5
|
+
export declare const TargetMessage: (...dataOrPipes: any[]) => ParameterDecorator;
|
|
6
|
+
export declare const TargetUser: (...dataOrPipes: any[]) => ParameterDecorator;
|
|
7
|
+
export declare const TargetMember: (...dataOrPipes: any[]) => ParameterDecorator;
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TargetMember = exports.TargetUser = exports.TargetMessage = exports.Target = void 0;
|
|
4
|
-
const common_1 = require("@nestjs/common");
|
|
5
|
-
const context_1 = require("../../../context");
|
|
6
|
-
/**
|
|
7
|
-
* @deprecated Use `@TargetMessage`, `@TargetUser` or `@TargetMember` instead
|
|
8
|
-
*/
|
|
9
|
-
exports.Target = (0, common_1.createParamDecorator)((_, context) => {
|
|
10
|
-
const necordContext = context_1.NecordExecutionContext.create(context);
|
|
11
|
-
const [interaction] = necordContext.getContext();
|
|
12
|
-
if (!interaction.isContextMenuCommand())
|
|
13
|
-
return null;
|
|
14
|
-
return interaction.isMessageContextMenuCommand()
|
|
15
|
-
? interaction.options.getMessage('message')
|
|
16
|
-
: interaction.options.getUser('user');
|
|
17
|
-
});
|
|
18
|
-
exports.TargetMessage = (0, common_1.createParamDecorator)((_, context) => {
|
|
19
|
-
const necordContext = context_1.NecordExecutionContext.create(context);
|
|
20
|
-
const [interaction] = necordContext.getContext();
|
|
21
|
-
if (!interaction.isMessageContextMenuCommand())
|
|
22
|
-
return null;
|
|
23
|
-
return interaction.targetMessage;
|
|
24
|
-
});
|
|
25
|
-
exports.TargetUser = (0, common_1.createParamDecorator)((_, context) => {
|
|
26
|
-
const necordContext = context_1.NecordExecutionContext.create(context);
|
|
27
|
-
const [interaction] = necordContext.getContext();
|
|
28
|
-
if (!interaction.isUserContextMenuCommand())
|
|
29
|
-
return null;
|
|
30
|
-
return interaction.targetUser;
|
|
31
|
-
});
|
|
32
|
-
exports.TargetMember = (0, common_1.createParamDecorator)((_, context) => {
|
|
33
|
-
const necordContext = context_1.NecordExecutionContext.create(context);
|
|
34
|
-
const [interaction] = necordContext.getContext();
|
|
35
|
-
if (!interaction.isUserContextMenuCommand())
|
|
36
|
-
return null;
|
|
37
|
-
return interaction.targetMember;
|
|
38
|
-
});
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TargetMember = exports.TargetUser = exports.TargetMessage = exports.Target = void 0;
|
|
4
|
+
const common_1 = require("@nestjs/common");
|
|
5
|
+
const context_1 = require("../../../context");
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated Use `@TargetMessage`, `@TargetUser` or `@TargetMember` instead
|
|
8
|
+
*/
|
|
9
|
+
exports.Target = (0, common_1.createParamDecorator)((_, context) => {
|
|
10
|
+
const necordContext = context_1.NecordExecutionContext.create(context);
|
|
11
|
+
const [interaction] = necordContext.getContext();
|
|
12
|
+
if (!interaction.isContextMenuCommand())
|
|
13
|
+
return null;
|
|
14
|
+
return interaction.isMessageContextMenuCommand()
|
|
15
|
+
? interaction.options.getMessage('message')
|
|
16
|
+
: interaction.options.getUser('user');
|
|
17
|
+
});
|
|
18
|
+
exports.TargetMessage = (0, common_1.createParamDecorator)((_, context) => {
|
|
19
|
+
const necordContext = context_1.NecordExecutionContext.create(context);
|
|
20
|
+
const [interaction] = necordContext.getContext();
|
|
21
|
+
if (!interaction.isMessageContextMenuCommand())
|
|
22
|
+
return null;
|
|
23
|
+
return interaction.targetMessage;
|
|
24
|
+
});
|
|
25
|
+
exports.TargetUser = (0, common_1.createParamDecorator)((_, context) => {
|
|
26
|
+
const necordContext = context_1.NecordExecutionContext.create(context);
|
|
27
|
+
const [interaction] = necordContext.getContext();
|
|
28
|
+
if (!interaction.isUserContextMenuCommand())
|
|
29
|
+
return null;
|
|
30
|
+
return interaction.targetUser;
|
|
31
|
+
});
|
|
32
|
+
exports.TargetMember = (0, common_1.createParamDecorator)((_, context) => {
|
|
33
|
+
const necordContext = context_1.NecordExecutionContext.create(context);
|
|
34
|
+
const [interaction] = necordContext.getContext();
|
|
35
|
+
if (!interaction.isUserContextMenuCommand())
|
|
36
|
+
return null;
|
|
37
|
+
return interaction.targetMember;
|
|
38
|
+
});
|