@globalart/nestcord 1.4.3 → 1.5.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.
@@ -5,8 +5,8 @@
5
5
  */
6
6
  export declare const AttachmentOption: (data: {
7
7
  name: string;
8
- description: string;
9
8
  name_localizations?: Partial<Record<"id" | "en-US" | "en-GB" | "bg" | "zh-CN" | "zh-TW" | "hr" | "cs" | "da" | "nl" | "fi" | "fr" | "de" | "el" | "hi" | "hu" | "it" | "ja" | "ko" | "lt" | "no" | "pl" | "pt-BR" | "ro" | "ru" | "es-ES" | "es-419" | "sv-SE" | "th" | "tr" | "uk" | "vi", string>>;
9
+ description: string;
10
10
  description_localizations?: Partial<Record<"id" | "en-US" | "en-GB" | "bg" | "zh-CN" | "zh-TW" | "hr" | "cs" | "da" | "nl" | "fi" | "fr" | "de" | "el" | "hi" | "hu" | "it" | "ja" | "ko" | "lt" | "no" | "pl" | "pt-BR" | "ro" | "ru" | "es-ES" | "es-419" | "sv-SE" | "th" | "tr" | "uk" | "vi", string>>;
11
11
  required?: boolean;
12
12
  }) => PropertyDecorator;
@@ -5,8 +5,8 @@
5
5
  */
6
6
  export declare const BooleanOption: (data: {
7
7
  name: string;
8
- description: string;
9
8
  name_localizations?: Partial<Record<"id" | "en-US" | "en-GB" | "bg" | "zh-CN" | "zh-TW" | "hr" | "cs" | "da" | "nl" | "fi" | "fr" | "de" | "el" | "hi" | "hu" | "it" | "ja" | "ko" | "lt" | "no" | "pl" | "pt-BR" | "ro" | "ru" | "es-ES" | "es-419" | "sv-SE" | "th" | "tr" | "uk" | "vi", string>>;
9
+ description: string;
10
10
  description_localizations?: Partial<Record<"id" | "en-US" | "en-GB" | "bg" | "zh-CN" | "zh-TW" | "hr" | "cs" | "da" | "nl" | "fi" | "fr" | "de" | "el" | "hi" | "hu" | "it" | "ja" | "ko" | "lt" | "no" | "pl" | "pt-BR" | "ro" | "ru" | "es-ES" | "es-419" | "sv-SE" | "th" | "tr" | "uk" | "vi", string>>;
11
11
  required?: boolean;
12
12
  }) => PropertyDecorator;
@@ -5,8 +5,8 @@
5
5
  */
6
6
  export declare const ChannelOption: (data: {
7
7
  name: string;
8
- description: string;
9
8
  name_localizations?: Partial<Record<"id" | "en-US" | "en-GB" | "bg" | "zh-CN" | "zh-TW" | "hr" | "cs" | "da" | "nl" | "fi" | "fr" | "de" | "el" | "hi" | "hu" | "it" | "ja" | "ko" | "lt" | "no" | "pl" | "pt-BR" | "ro" | "ru" | "es-ES" | "es-419" | "sv-SE" | "th" | "tr" | "uk" | "vi", string>>;
9
+ description: string;
10
10
  description_localizations?: Partial<Record<"id" | "en-US" | "en-GB" | "bg" | "zh-CN" | "zh-TW" | "hr" | "cs" | "da" | "nl" | "fi" | "fr" | "de" | "el" | "hi" | "hu" | "it" | "ja" | "ko" | "lt" | "no" | "pl" | "pt-BR" | "ro" | "ru" | "es-ES" | "es-419" | "sv-SE" | "th" | "tr" | "uk" | "vi", string>>;
11
11
  required?: boolean;
12
12
  channel_types?: (import("discord.js").ChannelType.GuildText | import("discord.js").ChannelType.GuildVoice | import("discord.js").ChannelType.GuildCategory | import("discord.js").ChannelType.GuildAnnouncement | import("discord.js").ChannelType.AnnouncementThread | import("discord.js").ChannelType.PublicThread | import("discord.js").ChannelType.PrivateThread | import("discord.js").ChannelType.GuildStageVoice | import("discord.js").ChannelType.GuildDirectory | import("discord.js").ChannelType.GuildForum | import("discord.js").ChannelType.GuildMedia)[];
@@ -5,8 +5,8 @@
5
5
  */
6
6
  export declare const IntegerOption: (data: {
7
7
  name: string;
8
- description: string;
9
8
  name_localizations?: Partial<Record<"id" | "en-US" | "en-GB" | "bg" | "zh-CN" | "zh-TW" | "hr" | "cs" | "da" | "nl" | "fi" | "fr" | "de" | "el" | "hi" | "hu" | "it" | "ja" | "ko" | "lt" | "no" | "pl" | "pt-BR" | "ro" | "ru" | "es-ES" | "es-419" | "sv-SE" | "th" | "tr" | "uk" | "vi", string>>;
9
+ description: string;
10
10
  description_localizations?: Partial<Record<"id" | "en-US" | "en-GB" | "bg" | "zh-CN" | "zh-TW" | "hr" | "cs" | "da" | "nl" | "fi" | "fr" | "de" | "el" | "hi" | "hu" | "it" | "ja" | "ko" | "lt" | "no" | "pl" | "pt-BR" | "ro" | "ru" | "es-ES" | "es-419" | "sv-SE" | "th" | "tr" | "uk" | "vi", string>>;
11
11
  required?: boolean;
12
12
  choices?: [];
@@ -15,8 +15,8 @@ export declare const IntegerOption: (data: {
15
15
  autocomplete: true;
16
16
  } | {
17
17
  name: string;
18
- description: string;
19
18
  name_localizations?: Partial<Record<"id" | "en-US" | "en-GB" | "bg" | "zh-CN" | "zh-TW" | "hr" | "cs" | "da" | "nl" | "fi" | "fr" | "de" | "el" | "hi" | "hu" | "it" | "ja" | "ko" | "lt" | "no" | "pl" | "pt-BR" | "ro" | "ru" | "es-ES" | "es-419" | "sv-SE" | "th" | "tr" | "uk" | "vi", string>>;
19
+ description: string;
20
20
  description_localizations?: Partial<Record<"id" | "en-US" | "en-GB" | "bg" | "zh-CN" | "zh-TW" | "hr" | "cs" | "da" | "nl" | "fi" | "fr" | "de" | "el" | "hi" | "hu" | "it" | "ja" | "ko" | "lt" | "no" | "pl" | "pt-BR" | "ro" | "ru" | "es-ES" | "es-419" | "sv-SE" | "th" | "tr" | "uk" | "vi", string>>;
21
21
  required?: boolean;
22
22
  choices?: import("discord.js").APIApplicationCommandOptionChoice<number>[];
@@ -5,8 +5,8 @@
5
5
  */
6
6
  export declare const MemberOption: (data: {
7
7
  name: string;
8
- description: string;
9
8
  name_localizations?: Partial<Record<"id" | "en-US" | "en-GB" | "bg" | "zh-CN" | "zh-TW" | "hr" | "cs" | "da" | "nl" | "fi" | "fr" | "de" | "el" | "hi" | "hu" | "it" | "ja" | "ko" | "lt" | "no" | "pl" | "pt-BR" | "ro" | "ru" | "es-ES" | "es-419" | "sv-SE" | "th" | "tr" | "uk" | "vi", string>>;
9
+ description: string;
10
10
  description_localizations?: Partial<Record<"id" | "en-US" | "en-GB" | "bg" | "zh-CN" | "zh-TW" | "hr" | "cs" | "da" | "nl" | "fi" | "fr" | "de" | "el" | "hi" | "hu" | "it" | "ja" | "ko" | "lt" | "no" | "pl" | "pt-BR" | "ro" | "ru" | "es-ES" | "es-419" | "sv-SE" | "th" | "tr" | "uk" | "vi", string>>;
11
11
  required?: boolean;
12
12
  }) => PropertyDecorator;
@@ -5,8 +5,8 @@
5
5
  */
6
6
  export declare const MentionableOption: (data: {
7
7
  name: string;
8
- description: string;
9
8
  name_localizations?: Partial<Record<"id" | "en-US" | "en-GB" | "bg" | "zh-CN" | "zh-TW" | "hr" | "cs" | "da" | "nl" | "fi" | "fr" | "de" | "el" | "hi" | "hu" | "it" | "ja" | "ko" | "lt" | "no" | "pl" | "pt-BR" | "ro" | "ru" | "es-ES" | "es-419" | "sv-SE" | "th" | "tr" | "uk" | "vi", string>>;
9
+ description: string;
10
10
  description_localizations?: Partial<Record<"id" | "en-US" | "en-GB" | "bg" | "zh-CN" | "zh-TW" | "hr" | "cs" | "da" | "nl" | "fi" | "fr" | "de" | "el" | "hi" | "hu" | "it" | "ja" | "ko" | "lt" | "no" | "pl" | "pt-BR" | "ro" | "ru" | "es-ES" | "es-419" | "sv-SE" | "th" | "tr" | "uk" | "vi", string>>;
11
11
  required?: boolean;
12
12
  }) => PropertyDecorator;
@@ -5,8 +5,8 @@
5
5
  */
6
6
  export declare const NumberOption: (data: {
7
7
  name: string;
8
- description: string;
9
8
  name_localizations?: Partial<Record<"id" | "en-US" | "en-GB" | "bg" | "zh-CN" | "zh-TW" | "hr" | "cs" | "da" | "nl" | "fi" | "fr" | "de" | "el" | "hi" | "hu" | "it" | "ja" | "ko" | "lt" | "no" | "pl" | "pt-BR" | "ro" | "ru" | "es-ES" | "es-419" | "sv-SE" | "th" | "tr" | "uk" | "vi", string>>;
9
+ description: string;
10
10
  description_localizations?: Partial<Record<"id" | "en-US" | "en-GB" | "bg" | "zh-CN" | "zh-TW" | "hr" | "cs" | "da" | "nl" | "fi" | "fr" | "de" | "el" | "hi" | "hu" | "it" | "ja" | "ko" | "lt" | "no" | "pl" | "pt-BR" | "ro" | "ru" | "es-ES" | "es-419" | "sv-SE" | "th" | "tr" | "uk" | "vi", string>>;
11
11
  required?: boolean;
12
12
  choices?: [];
@@ -15,8 +15,8 @@ export declare const NumberOption: (data: {
15
15
  autocomplete: true;
16
16
  } | {
17
17
  name: string;
18
- description: string;
19
18
  name_localizations?: Partial<Record<"id" | "en-US" | "en-GB" | "bg" | "zh-CN" | "zh-TW" | "hr" | "cs" | "da" | "nl" | "fi" | "fr" | "de" | "el" | "hi" | "hu" | "it" | "ja" | "ko" | "lt" | "no" | "pl" | "pt-BR" | "ro" | "ru" | "es-ES" | "es-419" | "sv-SE" | "th" | "tr" | "uk" | "vi", string>>;
19
+ description: string;
20
20
  description_localizations?: Partial<Record<"id" | "en-US" | "en-GB" | "bg" | "zh-CN" | "zh-TW" | "hr" | "cs" | "da" | "nl" | "fi" | "fr" | "de" | "el" | "hi" | "hu" | "it" | "ja" | "ko" | "lt" | "no" | "pl" | "pt-BR" | "ro" | "ru" | "es-ES" | "es-419" | "sv-SE" | "th" | "tr" | "uk" | "vi", string>>;
21
21
  required?: boolean;
22
22
  choices?: import("discord.js").APIApplicationCommandOptionChoice<number>[];
@@ -5,8 +5,8 @@
5
5
  */
6
6
  export declare const RoleOption: (data: {
7
7
  name: string;
8
- description: string;
9
8
  name_localizations?: Partial<Record<"id" | "en-US" | "en-GB" | "bg" | "zh-CN" | "zh-TW" | "hr" | "cs" | "da" | "nl" | "fi" | "fr" | "de" | "el" | "hi" | "hu" | "it" | "ja" | "ko" | "lt" | "no" | "pl" | "pt-BR" | "ro" | "ru" | "es-ES" | "es-419" | "sv-SE" | "th" | "tr" | "uk" | "vi", string>>;
9
+ description: string;
10
10
  description_localizations?: Partial<Record<"id" | "en-US" | "en-GB" | "bg" | "zh-CN" | "zh-TW" | "hr" | "cs" | "da" | "nl" | "fi" | "fr" | "de" | "el" | "hi" | "hu" | "it" | "ja" | "ko" | "lt" | "no" | "pl" | "pt-BR" | "ro" | "ru" | "es-ES" | "es-419" | "sv-SE" | "th" | "tr" | "uk" | "vi", string>>;
11
11
  required?: boolean;
12
12
  }) => PropertyDecorator;
@@ -5,8 +5,8 @@
5
5
  */
6
6
  export declare const StringOption: (data: {
7
7
  name: string;
8
- description: string;
9
8
  name_localizations?: Partial<Record<"id" | "en-US" | "en-GB" | "bg" | "zh-CN" | "zh-TW" | "hr" | "cs" | "da" | "nl" | "fi" | "fr" | "de" | "el" | "hi" | "hu" | "it" | "ja" | "ko" | "lt" | "no" | "pl" | "pt-BR" | "ro" | "ru" | "es-ES" | "es-419" | "sv-SE" | "th" | "tr" | "uk" | "vi", string>>;
9
+ description: string;
10
10
  description_localizations?: Partial<Record<"id" | "en-US" | "en-GB" | "bg" | "zh-CN" | "zh-TW" | "hr" | "cs" | "da" | "nl" | "fi" | "fr" | "de" | "el" | "hi" | "hu" | "it" | "ja" | "ko" | "lt" | "no" | "pl" | "pt-BR" | "ro" | "ru" | "es-ES" | "es-419" | "sv-SE" | "th" | "tr" | "uk" | "vi", string>>;
11
11
  required?: boolean;
12
12
  choices?: [];
@@ -15,8 +15,8 @@ export declare const StringOption: (data: {
15
15
  max_length?: number;
16
16
  } | {
17
17
  name: string;
18
- description: string;
19
18
  name_localizations?: Partial<Record<"id" | "en-US" | "en-GB" | "bg" | "zh-CN" | "zh-TW" | "hr" | "cs" | "da" | "nl" | "fi" | "fr" | "de" | "el" | "hi" | "hu" | "it" | "ja" | "ko" | "lt" | "no" | "pl" | "pt-BR" | "ro" | "ru" | "es-ES" | "es-419" | "sv-SE" | "th" | "tr" | "uk" | "vi", string>>;
19
+ description: string;
20
20
  description_localizations?: Partial<Record<"id" | "en-US" | "en-GB" | "bg" | "zh-CN" | "zh-TW" | "hr" | "cs" | "da" | "nl" | "fi" | "fr" | "de" | "el" | "hi" | "hu" | "it" | "ja" | "ko" | "lt" | "no" | "pl" | "pt-BR" | "ro" | "ru" | "es-ES" | "es-419" | "sv-SE" | "th" | "tr" | "uk" | "vi", string>>;
21
21
  required?: boolean;
22
22
  choices?: import("discord.js").APIApplicationCommandOptionChoice<string>[];
@@ -5,8 +5,8 @@
5
5
  */
6
6
  export declare const UserOption: (data: {
7
7
  name: string;
8
- description: string;
9
8
  name_localizations?: Partial<Record<"id" | "en-US" | "en-GB" | "bg" | "zh-CN" | "zh-TW" | "hr" | "cs" | "da" | "nl" | "fi" | "fr" | "de" | "el" | "hi" | "hu" | "it" | "ja" | "ko" | "lt" | "no" | "pl" | "pt-BR" | "ro" | "ru" | "es-ES" | "es-419" | "sv-SE" | "th" | "tr" | "uk" | "vi", string>>;
9
+ description: string;
10
10
  description_localizations?: Partial<Record<"id" | "en-US" | "en-GB" | "bg" | "zh-CN" | "zh-TW" | "hr" | "cs" | "da" | "nl" | "fi" | "fr" | "de" | "el" | "hi" | "hu" | "it" | "ja" | "ko" | "lt" | "no" | "pl" | "pt-BR" | "ro" | "ru" | "es-ES" | "es-419" | "sv-SE" | "th" | "tr" | "uk" | "vi", string>>;
11
11
  required?: boolean;
12
12
  }) => PropertyDecorator;
@@ -1,7 +1,6 @@
1
- import { NestCordEvents } from '../listener.interface';
2
1
  /**
3
2
  * Decorator that marks a method as a listener for discord.js client.
4
- * @param event The event name.
3
+ * @param event - The event or events name.
5
4
  * @returns The decorated method.
6
5
  */
7
- export declare const On: <K extends keyof E, E = NestCordEvents>(event: K) => import("@nestjs/common").CustomDecorator;
6
+ export declare const On: <K extends keyof import("discord.js").ClientEvents | "guildChannelPermissionsUpdate" | keyof import("..").CustomGuildAuditLogEntryCreateEvents | keyof import("..").CustomGuildMemberUpdateEvents | keyof import("..").CustomGuildUpdateEvents | keyof import("..").CustomMessageUpdateEvents | keyof import("..").CustomPresenceUpdateEvents | keyof import("..").CustomRoleUpdateEvents | keyof import("..").CustomThreadUpdateEvents | keyof import("..").CustomUserUpdateEvents | keyof import("..").CustomVoiceStateUpdateEvents>(event: K | K[]) => import("@nestjs/common").CustomDecorator;
@@ -4,7 +4,7 @@ exports.On = void 0;
4
4
  const listener_decorator_1 = require("./listener.decorator");
5
5
  /**
6
6
  * Decorator that marks a method as a listener for discord.js client.
7
- * @param event The event name.
7
+ * @param event - The event or events name.
8
8
  * @returns The decorated method.
9
9
  */
10
10
  const On = (event) => (0, listener_decorator_1.Listener)({ type: 'on', event });
@@ -1,7 +1,6 @@
1
- import { NestCordEvents } from '../listener.interface';
2
1
  /**
3
2
  * Decorator that marks a method as a listener for discord.js client.
4
- * @param event
3
+ * @param event - The event name to listen for once.
5
4
  * @returns The decorated method.
6
5
  */
7
- export declare const Once: <K extends keyof E, E = NestCordEvents>(event: K) => import("@nestjs/common").CustomDecorator;
6
+ export declare const Once: <K extends keyof import("discord.js").ClientEvents | "guildChannelPermissionsUpdate" | keyof import("..").CustomGuildAuditLogEntryCreateEvents | keyof import("..").CustomGuildMemberUpdateEvents | keyof import("..").CustomGuildUpdateEvents | keyof import("..").CustomMessageUpdateEvents | keyof import("..").CustomPresenceUpdateEvents | keyof import("..").CustomRoleUpdateEvents | keyof import("..").CustomThreadUpdateEvents | keyof import("..").CustomUserUpdateEvents | keyof import("..").CustomVoiceStateUpdateEvents>(event: K | K[]) => import("@nestjs/common").CustomDecorator;
@@ -4,7 +4,7 @@ exports.Once = void 0;
4
4
  const listener_decorator_1 = require("./listener.decorator");
5
5
  /**
6
6
  * Decorator that marks a method as a listener for discord.js client.
7
- * @param event
7
+ * @param event - The event name to listen for once.
8
8
  * @returns The decorated method.
9
9
  */
10
10
  const Once = (event) => (0, listener_decorator_1.Listener)({ type: 'once', event });
@@ -1,14 +1,14 @@
1
1
  import { NestCordBaseDiscovery } from '../context';
2
2
  export interface ListenerMeta {
3
3
  type: 'once' | 'on';
4
- event: string | symbol | number;
4
+ event: string | string[];
5
5
  }
6
6
  /**
7
7
  * Represents a listener discovery.
8
8
  */
9
9
  export declare class ListenerDiscovery extends NestCordBaseDiscovery<ListenerMeta> {
10
10
  getType(): "once" | "on";
11
- getEvent(): string;
11
+ getEvent(): string | string[];
12
12
  isListener(): this is ListenerDiscovery;
13
13
  toJSON(): ListenerMeta;
14
14
  }
@@ -10,7 +10,7 @@ class ListenerDiscovery extends context_1.NestCordBaseDiscovery {
10
10
  return this.meta.type;
11
11
  }
12
12
  getEvent() {
13
- return this.meta.event.toString();
13
+ return Array.isArray(this.meta.event) ? this.meta.event : this.meta.event.toString();
14
14
  }
15
15
  isListener() {
16
16
  return true;
@@ -38,9 +38,19 @@ let ListenersModule = class ListenersModule {
38
38
  this.reflector = reflector;
39
39
  }
40
40
  onModuleInit() {
41
- return this.explorerService
42
- .explore(decorators_1.Listener.KEY)
43
- .forEach((listener) => this.client[listener.getType()](listener.getEvent(), (...args) => listener.execute(args)));
41
+ const explorer = this.explorerService.explore(decorators_1.Listener.KEY);
42
+ explorer.forEach((listener) => {
43
+ const eventType = listener.getType();
44
+ const event = listener.getEvent();
45
+ if (Array.isArray(event)) {
46
+ event.forEach((e) => {
47
+ this.client[eventType](e, (...args) => listener.execute(args));
48
+ });
49
+ }
50
+ else {
51
+ this.client[eventType](event, (...args) => listener.execute(args));
52
+ }
53
+ });
44
54
  }
45
55
  onApplicationBootstrap() {
46
56
  const wrappers = this.discoveryService.getProviders({
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@globalart/nestcord",
3
3
  "description": "A module for creating Discord bots using NestJS, based on Discord.js",
4
- "version": "1.4.3",
4
+ "version": "1.5.0",
5
5
  "private": false,
6
6
  "scripts": {
7
7
  "build": "rimraf dist && tsc -p tsconfig.build.json",
@@ -64,14 +64,14 @@
64
64
  "@types/node": "20.14.2",
65
65
  "@typescript-eslint/eslint-plugin": "7.0.0",
66
66
  "@typescript-eslint/parser": "6.21.0",
67
- "discord-api-types": "0.37.87",
67
+ "discord-api-types": "0.37.89",
68
68
  "discord.js": "14.15.3",
69
69
  "eslint": "8.57.0",
70
70
  "eslint-config-prettier": "9.1.0",
71
71
  "eslint-plugin-prettier": "5.1.3",
72
72
  "husky": "9.0.11",
73
- "lint-staged": "15.2.5",
74
- "prettier": "3.3.1",
73
+ "lint-staged": "15.2.7",
74
+ "prettier": "3.3.2",
75
75
  "reflect-metadata": "0.2.2",
76
76
  "release-it": "17.3.0",
77
77
  "rimraf": "5.0.7",