xernerx 3.2.5 → 3.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.
Files changed (58) hide show
  1. package/dist/build/ContextCommand.d.ts +1 -1
  2. package/dist/build/ContextCommand.js +1 -1
  3. package/dist/build/ContextCommandBuilder.d.ts +40 -0
  4. package/dist/build/ContextCommandBuilder.js +84 -0
  5. package/dist/build/Event.d.ts +1 -1
  6. package/dist/build/Event.js +1 -1
  7. package/dist/build/EventBuilder.d.ts +17 -0
  8. package/dist/build/EventBuilder.js +35 -0
  9. package/dist/build/ExtensionBuilder.d.ts +7 -0
  10. package/dist/build/ExtensionBuilder.js +9 -0
  11. package/dist/build/Inhibitor.d.ts +3 -0
  12. package/dist/build/Inhibitor.js +3 -0
  13. package/dist/build/InhibitorBuilder.d.ts +19 -0
  14. package/dist/build/InhibitorBuilder.js +28 -0
  15. package/dist/build/MessageCommand.d.ts +2 -2
  16. package/dist/build/MessageCommand.js +1 -1
  17. package/dist/build/MessageCommandBuilder.d.ts +42 -0
  18. package/dist/build/MessageCommandBuilder.js +80 -0
  19. package/dist/build/SlashCommand.d.ts +3 -3
  20. package/dist/build/SlashCommand.js +3 -3
  21. package/dist/build/SlashCommandBuilder.d.ts +36 -0
  22. package/dist/build/SlashCommandBuilder.js +125 -0
  23. package/dist/build/XernerxExtension.d.ts +7 -0
  24. package/dist/build/XernerxExtension.js +9 -0
  25. package/dist/client/XernerxClient.d.ts +11 -7
  26. package/dist/client/XernerxClient.js +0 -2
  27. package/dist/handlers/CommandHandler.d.ts +4 -4
  28. package/dist/handlers/EventHandler.d.ts +2 -2
  29. package/dist/handlers/Handler.d.ts +6 -6
  30. package/dist/handlers/Handler.js +2 -1
  31. package/dist/handlers/InhibitorHandler.d.ts +2 -2
  32. package/dist/interfaces/ClientInterfaces.d.ts +8 -7
  33. package/dist/interfaces/CommandInterfaces.d.ts +1 -1
  34. package/dist/interfaces/HandlerInterfaces.d.ts +3 -11
  35. package/dist/main.d.ts +14 -13
  36. package/dist/main.js +16 -15
  37. package/dist/models/CommandArguments.d.ts +15 -7
  38. package/dist/models/CommandArguments.js +27 -33
  39. package/dist/models/CommandValidations.d.ts +4 -3
  40. package/dist/models/CommandValidations.js +9 -17
  41. package/dist/models/Events.d.ts +1 -0
  42. package/dist/models/Events.js +67 -140
  43. package/dist/models/Extensions.d.ts +2 -2
  44. package/dist/models/InhibitorValidations.d.ts +8 -13
  45. package/dist/models/InhibitorValidations.js +1 -1
  46. package/dist/types/Types.d.ts +29 -25
  47. package/dist/types/Types.js +1 -26
  48. package/dist/types/enums.d.ts +35 -0
  49. package/dist/types/enums.js +35 -0
  50. package/dist/types/interfaces.d.ts +25 -0
  51. package/dist/types/interfaces.js +1 -0
  52. package/dist/types/objects.d.ts +18 -0
  53. package/dist/types/objects.js +1 -0
  54. package/dist/types/options.d.ts +204 -0
  55. package/dist/types/options.js +1 -0
  56. package/dist/utils/ClientUtil.js +1 -2
  57. package/dist/utils/CommandUtil.d.ts +3 -3
  58. package/package.json +1 -1
@@ -0,0 +1,204 @@
1
+ import { CacheFactory, ChannelType, ContextMenuCommandType, MessageMentionOptions, Partials, PresenceData, RESTOptions, SweeperOptions, WebSocketOptions } from "discord.js";
2
+ import { ContextCommandType, EventEmitterType, ExtensionBuilder, InhibitorType } from "../main.js";
3
+ import { MessageCommandArgsTypes } from "./types.js";
4
+ export interface DiscordOptions {
5
+ shards?: number | number[] | "auto";
6
+ closeTimeout?: number;
7
+ shardCount?: number;
8
+ makeCache?: CacheFactory;
9
+ allowedMentions?: MessageMentionOptions;
10
+ partials?: Array<Partials>;
11
+ failIfNotExists?: boolean;
12
+ presence?: PresenceData;
13
+ intents: number[];
14
+ waitGuildTimeout?: number;
15
+ sweepers?: SweeperOptions;
16
+ ws?: WebSocketOptions;
17
+ rest?: RESTOptions;
18
+ jsonTransformer?: (obj: unknown) => unknown;
19
+ }
20
+ export interface ClientOptions {
21
+ ownerId?: string | string[];
22
+ clientPermissions?: bigint[];
23
+ userPermissions?: bigint[];
24
+ ignoreOwner?: boolean;
25
+ logging?: boolean;
26
+ cooldown?: {
27
+ default?: number;
28
+ cache?: number;
29
+ };
30
+ }
31
+ export interface HandlerOptions {
32
+ message?: MessageCommandHandlerOptions;
33
+ slash?: SlashCommandHandlerOptions;
34
+ context?: ContextCommandHandlerOptions;
35
+ events?: EventHandlerOptions;
36
+ inhibitors?: InhibitorHandlerOptions;
37
+ }
38
+ export interface ExtensionOptions {
39
+ extensions: Array<ExtensionBuilder>;
40
+ logging?: boolean;
41
+ }
42
+ export interface MessageCommandOptions {
43
+ name: string;
44
+ regex?: string;
45
+ aliases?: string[];
46
+ description?: string;
47
+ prefix?: string | string[];
48
+ info?: string;
49
+ category?: string;
50
+ owner?: boolean;
51
+ channelType?: ChannelType | ChannelType[];
52
+ separator?: string;
53
+ cooldown?: number;
54
+ ignoreOwner?: boolean;
55
+ channels?: string[];
56
+ guilds?: string[];
57
+ userPermissions?: bigint[];
58
+ clientPermissions?: bigint[];
59
+ commandType?: string;
60
+ args: Array<MessageArgOptions>;
61
+ }
62
+ export interface ContextCommandOptions {
63
+ name: string;
64
+ type: ContextMenuCommandType | ContextCommandType | number;
65
+ description?: string;
66
+ info?: string;
67
+ category?: string;
68
+ owner?: boolean;
69
+ channelType?: ChannelType;
70
+ cooldown?: number;
71
+ ignoreOwner?: boolean;
72
+ channels?: string[];
73
+ guilds?: string[];
74
+ userPermissions?: bigint[];
75
+ clientPermissions?: bigint[];
76
+ defaultMemberPermissions?: bigint | number | bigint | null | undefined;
77
+ DMPermission?: undefined | null | boolean;
78
+ nameLocalization?: {
79
+ locale: "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" | "sv-SE" | "th" | "tr" | "uk" | "vi";
80
+ localizedName: null | string;
81
+ };
82
+ nameLocalizations?: null | Partial<Record<"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" | "sv-SE" | "th" | "tr" | "uk" | "vi", null | string>>;
83
+ commandType?: string;
84
+ defer?: {
85
+ reply?: boolean;
86
+ ephemeral?: boolean;
87
+ fetchReply?: boolean;
88
+ };
89
+ }
90
+ export interface MessageArgOptions {
91
+ type: MessageCommandArgsTypes;
92
+ content?: string;
93
+ name: string;
94
+ prompt: {
95
+ reply: string;
96
+ send: string;
97
+ };
98
+ default: string | Function;
99
+ }
100
+ export interface SlashArgOptions {
101
+ type: "string" | "number" | "boolean" | "user" | "channel" | "role" | "mentionable" | "integer";
102
+ name: string;
103
+ choices: Array<{
104
+ name: string;
105
+ value: string;
106
+ }>;
107
+ required: boolean;
108
+ description: string;
109
+ }
110
+ export interface SlashSubcommandOptions {
111
+ name: string;
112
+ description: string;
113
+ args: Array<SlashArgOptions>;
114
+ }
115
+ export interface SlashGroupOptions {
116
+ name: string;
117
+ description: string;
118
+ subcommands: Array<SlashSubcommandOptions>;
119
+ }
120
+ export interface SlashCommandOptions {
121
+ name: string;
122
+ description: string;
123
+ info?: string;
124
+ category?: string;
125
+ owner?: boolean;
126
+ channelType?: ChannelType;
127
+ separator?: string;
128
+ cooldown?: number;
129
+ ignoreOwner?: boolean;
130
+ channels?: string[];
131
+ guilds?: string[];
132
+ userPermissions?: bigint[];
133
+ clientPermissions?: bigint[];
134
+ args?: Array<SlashArgOptions>;
135
+ subcommands?: Array<SlashSubcommandOptions>;
136
+ groups?: Array<SlashGroupOptions>;
137
+ commandType?: string;
138
+ defer?: {
139
+ reply?: boolean;
140
+ ephemeral?: boolean;
141
+ fetchReply?: boolean;
142
+ };
143
+ }
144
+ export interface MessageCommandHandlerOptions {
145
+ directory: string;
146
+ prefix: string[] | string;
147
+ allowMention?: boolean;
148
+ cooldown?: number;
149
+ userPermissions?: bigint[];
150
+ clientPermissions?: bigint[];
151
+ handleEdits?: boolean;
152
+ handleDeletes?: boolean;
153
+ handleTyping?: boolean;
154
+ util?: boolean;
155
+ logging?: boolean;
156
+ }
157
+ export interface SlashCommandHandlerOptions {
158
+ directory: string;
159
+ guildId: string;
160
+ global: boolean;
161
+ cooldown?: number;
162
+ userPermissions?: bigint[];
163
+ clientPermissions?: bigint[];
164
+ util?: boolean;
165
+ logging?: boolean;
166
+ defer?: {
167
+ reply?: boolean;
168
+ ephemeral?: boolean;
169
+ fetchReply?: boolean;
170
+ };
171
+ }
172
+ export interface ContextCommandHandlerOptions {
173
+ directory: string;
174
+ guildId: string;
175
+ global: boolean;
176
+ cooldown?: number;
177
+ userPermissions?: bigint[];
178
+ clientPermissions?: bigint[];
179
+ util?: boolean;
180
+ logging?: boolean;
181
+ defer?: {
182
+ reply?: boolean;
183
+ ephemeral?: boolean;
184
+ fetchReply?: boolean;
185
+ };
186
+ }
187
+ export interface EventHandlerOptions {
188
+ directory: string;
189
+ logging?: boolean;
190
+ }
191
+ export interface EventOptions {
192
+ name: string;
193
+ emitter?: EventEmitterType;
194
+ type?: string;
195
+ once?: boolean;
196
+ }
197
+ export interface InhibitorHandlerOptions {
198
+ directory: string;
199
+ logging?: boolean;
200
+ }
201
+ export interface InhibitorOptions {
202
+ name: string;
203
+ type: InhibitorType;
204
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -43,8 +43,7 @@ export class ClientUtil {
43
43
  throw new XernerxError(`Expected name to be of type string, received ${typeof name} instead!`);
44
44
  const commands = [];
45
45
  this.getAllCommands()
46
- .filter((c) => (c.data?.name?.toLowerCase() || c.name?.toLowerCase()) ==
47
- name?.toLowerCase())
46
+ .filter((c) => (c.data?.name?.toLowerCase() || c.name?.toLowerCase()) == name?.toLowerCase())
48
47
  .map((c) => {
49
48
  if (c?.data?.options?.length > 0) {
50
49
  c?.data?.options?.map((option) => {
@@ -1,6 +1,6 @@
1
1
  import { ActionRowBuilder, ButtonBuilder, EmbedBuilder, Interaction, Message, MessagePayload, StringSelectMenuBuilder } from "discord.js";
2
2
  import XernerxClient from "../client/XernerxClient.js";
3
- import { XernerxMessage } from "../interfaces/HandlerInterfaces.js";
3
+ import { XernerxMessage } from "../types/types.js";
4
4
  interface SelectMenuOptions {
5
5
  index?: EmbedBuilder;
6
6
  row?: ActionRowBuilder;
@@ -32,7 +32,7 @@ export declare class MessageCommandUtil {
32
32
  reply(content: MessagePayload | string): Promise<Message<boolean> | undefined>;
33
33
  send(content: MessagePayload | string): Promise<Message<true> | Message<false> | undefined>;
34
34
  defer(time: number): Promise<unknown>;
35
- getCommands(): import("@discordjs/collection").Collection<string, import("../main.js").MessageCommand>;
35
+ getCommands(): import("@discordjs/collection").Collection<string, import("../main.js").MessageCommandBuilder>;
36
36
  isOwner(): boolean;
37
37
  }
38
38
  export declare class InteractionCommandUtil {
@@ -42,7 +42,7 @@ export declare class InteractionCommandUtil {
42
42
  constructor(client: XernerxClient, interaction: Interaction);
43
43
  reply(content: MessagePayload | string): any;
44
44
  defer(time: number): Promise<unknown>;
45
- getCommands(): import("@discordjs/collection").Collection<string, object>;
45
+ getCommands(): import("@discordjs/collection").Collection<string, import("../main.js").SlashCommandBuilder> | import("@discordjs/collection").Collection<string, import("../main.js").ContextCommandBuilder>;
46
46
  selectMenuPaginator(embeds: Array<EmbedBuilder>, options?: SelectMenuOptions): void;
47
47
  buttonPaginator(embeds: Array<EmbedBuilder>, options: ButtonOptions): void;
48
48
  isOwner(): boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xernerx",
3
- "version": "3.2.5",
3
+ "version": "3.3.0",
4
4
  "type": "module",
5
5
  "description": "A bot framework for discord.js.",
6
6
  "main": "dist/main.js",