Comparing version 1.0.5-dev.1635647767.7852e8b to 1.0.5
@@ -1,2 +0,1 @@ | ||
import { ContextMenuCommandBuilder } from '@discordjs/builders'; | ||
import { ListenerMetadata } from './listener-metadata.interface'; | ||
@@ -8,10 +7,2 @@ import { ApplicationCommandData, ApplicationCommandOptionData } from 'discord.js'; | ||
export declare type ListenerExecuteMetadata = ListenerMetadata & ExecuteMetadata; | ||
export declare type ContextMenuExecuteMetadata = ContextMenuCommandBuilder & ExecuteMetadata; | ||
export declare type SlashCommandExecuteMetadata = { | ||
name: string; | ||
description: string; | ||
group?: string; | ||
subGroup?: string; | ||
options: ApplicationCommandOptionData[]; | ||
} & ExecuteMetadata; | ||
export declare type ApplicationCommandExecuteMetadata = ApplicationCommandData & ExecuteMetadata & { | ||
@@ -18,0 +9,0 @@ description: string; |
@@ -1,2 +0,2 @@ | ||
import { ChannelType } from 'discord-api-types'; | ||
import { ChannelTypes } from 'discord.js/typings/enums'; | ||
export declare type OptionMetadata = { | ||
@@ -8,3 +8,3 @@ name: string; | ||
export declare type ChannelOptionMetadata = OptionMetadata & { | ||
types: Exclude<ChannelType, ChannelType.DM | ChannelType.GroupDM>[]; | ||
types: Exclude<ChannelTypes, ChannelTypes.DM | ChannelTypes.GROUP_DM>[]; | ||
}; | ||
@@ -11,0 +11,0 @@ export declare type PrimitiveOptionMetadata<V = string> = OptionMetadata & { |
@@ -23,3 +23,2 @@ "use strict"; | ||
const services_1 = require("./services"); | ||
const registry_service_1 = require("./services/registry.service"); | ||
const necord_client_1 = require("./necord-client"); | ||
@@ -76,6 +75,6 @@ const necord_constants_1 = require("./necord.constants"); | ||
imports: [core_1.DiscoveryModule], | ||
providers: [services_1.MetadataAccessorService, registry_service_1.RegistryService, necord_client_1.NecordClient, services_1.RestService, services_1.ExplorerService], | ||
exports: [necord_client_1.NecordClient, services_1.RestService] | ||
providers: [services_1.MetadataAccessorService, services_1.ApplicationCommandsService, necord_client_1.NecordClient, services_1.ExplorerService], | ||
exports: [necord_client_1.NecordClient] | ||
}) | ||
], NecordModule); | ||
exports.NecordModule = NecordModule; |
import { OnModuleInit } from '@nestjs/common'; | ||
import { DiscoveryService, MetadataScanner } from '@nestjs/core'; | ||
import { MetadataAccessorService } from './metadata-accessor.service'; | ||
import { RegistryService } from './registry.service'; | ||
import { ApplicationCommandsService } from './application-commands.service'; | ||
import { ExternalContextCreator } from '@nestjs/core/helpers/external-context-creator'; | ||
import { NecordClient } from '../necord-client'; | ||
export declare class ExplorerService implements OnModuleInit { | ||
@@ -12,4 +13,6 @@ private readonly commandsService; | ||
private readonly metadataAccessor; | ||
private readonly necordClient; | ||
private readonly logger; | ||
private readonly necordParamsFactory; | ||
constructor(commandsService: RegistryService, discoveryService: DiscoveryService, externalContextCreator: ExternalContextCreator, metadataScanner: MetadataScanner, metadataAccessor: MetadataAccessorService); | ||
constructor(commandsService: ApplicationCommandsService, discoveryService: DiscoveryService, externalContextCreator: ExternalContextCreator, metadataScanner: MetadataScanner, metadataAccessor: MetadataAccessorService, necordClient: NecordClient); | ||
onModuleInit(): void; | ||
@@ -16,0 +19,0 @@ private explore; |
@@ -11,2 +11,3 @@ "use strict"; | ||
}; | ||
var ExplorerService_1; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -20,6 +21,7 @@ exports.ExplorerService = void 0; | ||
const metadata_accessor_service_1 = require("./metadata-accessor.service"); | ||
const registry_service_1 = require("./registry.service"); | ||
const application_commands_service_1 = require("./application-commands.service"); | ||
const external_context_creator_1 = require("@nestjs/core/helpers/external-context-creator"); | ||
let ExplorerService = class ExplorerService { | ||
constructor(commandsService, discoveryService, externalContextCreator, metadataScanner, metadataAccessor) { | ||
const necord_client_1 = require("../necord-client"); | ||
let ExplorerService = ExplorerService_1 = class ExplorerService { | ||
constructor(commandsService, discoveryService, externalContextCreator, metadataScanner, metadataAccessor, necordClient) { | ||
this.commandsService = commandsService; | ||
@@ -30,2 +32,4 @@ this.discoveryService = discoveryService; | ||
this.metadataAccessor = metadataAccessor; | ||
this.necordClient = necordClient; | ||
this.logger = new common_1.Logger(ExplorerService_1.name); | ||
this.necordParamsFactory = new context_1.NecordParamsFactory(); | ||
@@ -44,7 +48,12 @@ } | ||
const listeners = (0, utils_1.flatMap)(wrappers, (instance, prototype) => this.filterListener(instance, prototype)); | ||
listeners.forEach(listener => this.commandsService.registerListener(listener)); | ||
listeners.forEach(listener => { | ||
this.logger.log(`Registered new listener for event "${listener.event}"`); | ||
this.necordClient[listener.once ? 'once' : 'on'](listener.event, (...args) => typeof listener.filter === 'function' | ||
? listener.filter(...args) && listener.execute(...args) | ||
: listener.execute(...args)); | ||
}); | ||
} | ||
registerApplicationCommands(wrappers) { | ||
const applicationCommands = (0, utils_1.flatMap)(wrappers, (instance, prototype) => this.filterSlashCommands(instance, prototype)); | ||
return this.commandsService.registerApplicationCommands(applicationCommands); | ||
this.commandsService.registerApplicationCommands(applicationCommands); | ||
} | ||
@@ -77,10 +86,11 @@ filterListener(instance, prototype) { | ||
}; | ||
ExplorerService = __decorate([ | ||
ExplorerService = ExplorerService_1 = __decorate([ | ||
(0, common_1.Injectable)(), | ||
__metadata("design:paramtypes", [registry_service_1.RegistryService, | ||
__metadata("design:paramtypes", [application_commands_service_1.ApplicationCommandsService, | ||
core_1.DiscoveryService, | ||
external_context_creator_1.ExternalContextCreator, | ||
core_1.MetadataScanner, | ||
metadata_accessor_service_1.MetadataAccessorService]) | ||
metadata_accessor_service_1.MetadataAccessorService, | ||
necord_client_1.NecordClient]) | ||
], ExplorerService); | ||
exports.ExplorerService = ExplorerService; |
export * from './explorer.service'; | ||
export * from './metadata-accessor.service'; | ||
export * from './rest.service'; | ||
export * from './application-commands.service'; |
@@ -15,2 +15,2 @@ "use strict"; | ||
__exportStar(require("./metadata-accessor.service"), exports); | ||
__exportStar(require("./rest.service"), exports); | ||
__exportStar(require("./application-commands.service"), exports); |
{ | ||
"license": "MIT", | ||
"name": "necord", | ||
"version": "1.0.5-dev.1635647767.7852e8b", | ||
"version": "1.0.5", | ||
"description": "A Discord bot framework built on top of Discord.js and Nest.js for advanced and amazing bots.", | ||
@@ -47,3 +47,2 @@ "keywords": [ | ||
"@discordjs/builders": "0.8.1", | ||
"@discordjs/rest": "0.1.0-canary.0", | ||
"@favware/npm-deprecate": "^1.0.4", | ||
@@ -55,3 +54,2 @@ "@nestjs/common": "^8.0.0", | ||
"@typescript-eslint/parser": "4.33.0", | ||
"discord-api-types": "0.24.0", | ||
"discord.js": "13.2.0", | ||
@@ -71,6 +69,4 @@ "eslint": "7.32.0", | ||
"@discordjs/builders": "^0.7.0", | ||
"@discordjs/rest": "^0.1.0-canary.0", | ||
"@nestjs/common": "^8.0.0", | ||
"@nestjs/core": "^8.0.0", | ||
"discord-api-types": ":0.24.0", | ||
"discord.js": "^13.2.0", | ||
@@ -77,0 +73,0 @@ "reflect-metadata": "^0.1.13", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
6
20
2
60893
87
1101