djs-builder 0.5.10 → 0.5.31

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.
@@ -1,321 +1,322 @@
1
1
  import {
2
- ActionRowBuilder,
3
2
  ButtonBuilder,
3
+ ActionRowBuilder,
4
4
  EmbedBuilder,
5
+ Message,
6
+ MessageComponentInteraction,
7
+ MessageActionRowComponentBuilder,
5
8
  ButtonStyle,
6
9
  StringSelectMenuBuilder,
7
- TextChannel,
8
- Message,
9
- Interaction,
10
- ButtonInteraction,
11
- StringSelectMenuInteraction,
12
- } from 'discord.js';
13
-
14
- interface ButtonSettings {
15
- label: string;
16
- style: ButtonStyle;
17
- emoji?: string;
18
- onClick?: () => void;
19
- }
20
-
21
- interface EmbedOptions {
22
- homePage: number;
23
- embeds: EmbedBuilder[];
24
- defaultPage: number;
25
- dynamicUpdate?: (currentPage: number) => EmbedBuilder;
26
- }
27
-
28
- interface TimeoutOptions {
29
- duration: number;
30
- disableComponents: boolean;
31
- onTimeout?: () => void;
32
- }
33
-
34
- interface PaginationOptions {
35
- embedOptions: EmbedOptions;
36
- timeoutOptions?: TimeoutOptions;
37
- restrictToUser?: string | null;
38
- navigationMenu?: boolean;
39
- loopNavigation?: boolean;
40
- buttonSettings?: {
41
- first?: ButtonSettings;
42
- previous?: ButtonSettings;
43
- home?: ButtonSettings;
44
- next?: ButtonSettings;
45
- last?: ButtonSettings;
10
+ } from "discord.js";
11
+
12
+ interface PagerOptions {
13
+ firstLast?: boolean;
14
+ deleteOption?: boolean;
15
+ otherComponents?: ActionRowBuilder<MessageActionRowComponentBuilder>[];
16
+ home?: {
17
+ home_Option?: boolean;
18
+ home_page?: number;
46
19
  };
47
- additionalComponents?: ActionRowBuilder<any>[];
48
- attachments?: any[];
49
- content?: string;
50
- channel?: TextChannel;
51
- context?: Interaction;
52
- autoRefresh?: {
53
- interval: number;
54
- updateContent: () => void;
20
+ timeOption?: {
21
+ timeOut?: number;
22
+ disable?: boolean;
23
+ deletes?: boolean;
24
+ custom?: (() => void);
55
25
  };
56
- }
57
-
58
- export class Pagination {
59
- private embedOptions: EmbedOptions;
60
- private timeoutOptions: TimeoutOptions;
61
- private restrictToUser: string | null;
62
- private navigationMenu: boolean;
63
- private loopNavigation: boolean;
64
- private buttonSettings: {
65
- first?: ButtonSettings;
66
- previous?: ButtonSettings;
67
- home?: ButtonSettings;
68
- next?: ButtonSettings;
69
- last?: ButtonSettings;
26
+ user_only?: {
27
+ user_status?: boolean;
28
+ reply?: string;
70
29
  };
71
- private additionalComponents: ActionRowBuilder<any>[];
72
- private attachments: any[];
73
- private content: string | null;
74
- private channel?: TextChannel;
75
- private context?: Interaction;
76
- private components: ActionRowBuilder<any>[];
77
- private message?: Message;
78
- private autoRefresh?: {
79
- interval: number;
80
- updateContent: () => void;
30
+ style?: {
31
+ nextAndBack?: ButtonStyle;
32
+ firstAndLast?: ButtonStyle;
33
+ homeStyle?: ButtonStyle;
34
+ deleteStyle?: ButtonStyle;
81
35
  };
82
-
83
- constructor({
84
- embedOptions,
85
- timeoutOptions = { duration: 60000, disableComponents: true },
86
- restrictToUser = null,
87
- navigationMenu = false,
88
- loopNavigation = true,
89
- buttonSettings = {
90
- first: { label: 'First', style: ButtonStyle.Primary },
91
- previous: { label: 'Previous', style: ButtonStyle.Secondary },
92
- home: { label: 'Home', style: ButtonStyle.Success },
93
- next: { label: 'Next', style: ButtonStyle.Secondary },
94
- last: { label: 'Last', style: ButtonStyle.Primary },
95
- },
96
- additionalComponents = [],
97
- attachments = [],
98
- content = '',
99
- channel,
100
- context,
101
- autoRefresh,
102
- }: PaginationOptions) {
103
- if (navigationMenu && (embedOptions.embeds.length < 1 || embedOptions.embeds.length > 25)) {
104
- throw new Error('The number of embeds must be between 1 and 25 to use the navigation menu.');
105
- }
106
-
107
- this.embedOptions = embedOptions;
108
- this.timeoutOptions = timeoutOptions;
109
- this.restrictToUser = restrictToUser;
110
- this.navigationMenu = navigationMenu;
111
- this.loopNavigation = loopNavigation;
112
- this.buttonSettings = buttonSettings;
113
- this.additionalComponents = additionalComponents;
114
- this.attachments = attachments;
115
- this.content = content;
116
- this.channel = channel;
117
- this.context = context;
118
- this.autoRefresh = autoRefresh;
119
-
120
- this.components = this.createPaginationRows();
121
-
122
- if (this.navigationMenu) {
123
- this.components.push(
124
- new ActionRowBuilder<StringSelectMenuBuilder>().addComponents(
125
- new StringSelectMenuBuilder()
126
- .setCustomId('select-djs-builder')
127
- .setPlaceholder('Select a page')
128
- .addOptions(
129
- this.embedOptions.embeds.map((_, index) => ({
130
- label: `Page ${index + 1}`,
131
- value: index.toString(),
132
- }))
133
- )
134
- )
135
- );
136
- }
137
-
138
- if (this.additionalComponents.length > 0) {
139
- this.additionalComponents.forEach((row) => {
140
- if (row.components.length > 5) {
141
- this.splitComponentsIntoRows(row.components).forEach((rowComponents) => {
142
- this.components.push(new ActionRowBuilder().addComponents(rowComponents));
143
- });
144
- } else {
145
- this.components.push(row);
146
- }
147
- });
148
- }
149
-
150
- if (this.autoRefresh) {
151
- setInterval(() => {
152
- this.autoRefresh!.updateContent();
153
- this.message?.edit({
154
- embeds: [this.getEmbed()],
155
- components: this.components,
156
- });
157
- }, this.autoRefresh.interval);
158
- }
36
+ label?: {
37
+ labelNext?: string | null;
38
+ labelBack?: string | null;
39
+ labelFirst?: string | null;
40
+ labelLast?: string | null;
41
+ labelHome?: string | null;
42
+ labelDelete?: string | null;
43
+ };
44
+ emoji?: {
45
+ emojiNext?: string;
46
+ emojiBack?: string;
47
+ emojiFirst?: string;
48
+ emojiLast?: string;
49
+ emojiHome?: string;
50
+ emojiDelete?: string;
51
+ };
52
+ pages?: {
53
+ embeds?: EmbedBuilder[];
54
+ attachment?: (string | Buffer)[];
55
+ content?: string[];
56
+ };
57
+ navigationMenu?: {
58
+ enabled?: boolean;
59
+ placeHolder?: string;
60
+ selects?: string[];
61
+ };
62
+ }
63
+
64
+ const CUSTOM_IDS = {
65
+ NEXT: "next-djs-builder",
66
+ BACK: "back-djs-builder",
67
+ FIRST: "first-djs-builder",
68
+ LAST: "last-djs-builder",
69
+ DELETE: "delete-djs-builder",
70
+ HOME: "home-djs-builder",
71
+ SELECT: "select-djs-builder"
72
+ };
73
+
74
+ const VALID_BUTTON_STYLES = [
75
+ ButtonStyle.Primary,
76
+ ButtonStyle.Secondary,
77
+ ButtonStyle.Success,
78
+ ButtonStyle.Danger
79
+ ];
80
+
81
+ const isValidEmoji = (emoji: string | undefined): boolean => {
82
+ if (!emoji) return false;
83
+ const unicodeEmojiPattern = /^[\u{1F600}-\u{1F64F}\u{1F300}-\u{1F5FF}\u{1F680}-\u{1F6FF}\u{1F700}-\u{1F77F}\u{1F780}-\u{1F7FF}\u{1F800}-\u{1F8FF}\u{1F900}-\u{1F9FF}\u{1FA00}-\u{1FA6F}\u{1FA70}-\u{1FAFF}\u{2600}-\u{26FF}\u{2700}-\u{27BF}\u{2300}-\u{23FF}\u{2B50}\u{2934}\u{2935}\u{3030}]+$/u;
84
+ return unicodeEmojiPattern.test(emoji) || /^\d+$/.test(emoji);
85
+ };
86
+
87
+ export class Pagination {
88
+ private message: Message;
89
+ private options: Required<PagerOptions>;
90
+ private buttons: ButtonBuilder[];
91
+ private components: ActionRowBuilder<MessageActionRowComponentBuilder>[];
92
+ private naw_page: number = 0;
93
+
94
+ constructor(message: Message, options: PagerOptions) {
95
+ this.message = message;
96
+ this.options = {
97
+ firstLast: false,
98
+ deleteOption: false,
99
+ otherComponents: [],
100
+ home: { home_Option: false, home_page: 0 },
101
+ timeOption: { timeOut: 86400000, disable: false, deletes: false, custom: undefined },
102
+ user_only: { user_status: false, reply: "You are not the command owner" },
103
+ style: { nextAndBack: ButtonStyle.Primary, firstAndLast: ButtonStyle.Secondary, homeStyle: ButtonStyle.Success, deleteStyle: ButtonStyle.Danger },
104
+ label: {},
105
+ emoji: { emojiNext: "➡", emojiBack: "⬅", emojiFirst: "⏪", emojiLast: "⏩", emojiHome: "🏠", emojiDelete: "🗑" },
106
+ pages: { embeds: [], attachment: [], content: [] },
107
+ navigationMenu: { enabled: false, placeHolder: "Choose a page", selects: [] },
108
+ ...options,
109
+ };
110
+
111
+ this.validateOptions();
112
+ this.buttons = this.createButtons();
113
+ this.components = this.createComponents();
114
+ }
115
+ private validateOptions() {
116
+ const { emoji } = this.options;
117
+ if (!Object.values(emoji).every(isValidEmoji)) {
118
+ throw new Error("Invalid emoji format. Must be either Unicode emojis or valid emoji IDs.");
119
+ }
120
+
121
+ const { style } = this.options;
122
+ if (!Object.values(style).every(style => VALID_BUTTON_STYLES.includes(style))) {
123
+ throw new Error("Invalid button style. Must be one of the predefined ButtonStyle values.");
124
+ }
125
+
126
+ if (this.options.deleteOption && this.options.home?.home_Option) {
127
+ throw new Error("You can't use 'home' and 'delete' together.");
128
+ }
129
+
130
+ if (this.options.timeOption?.disable && this.options.timeOption?.deletes) {
131
+ throw new Error("You can't use 'disable' and 'deletes' together.");
132
+ }
159
133
  }
160
-
161
- private createPaginationRows(): ActionRowBuilder<ButtonBuilder>[] {
162
- const rows: ActionRowBuilder<ButtonBuilder>[] = [];
163
- const buttons = [
164
- { id: 'first-djs-builder', settings: this.buttonSettings.first },
165
- { id: 'previous-djs-builder', settings: this.buttonSettings.previous },
166
- { id: 'home-djs-builder', settings: this.buttonSettings.home },
167
- { id: 'next-djs-builder', settings: this.buttonSettings.next },
168
- { id: 'last-djs-builder', settings: this.buttonSettings.last },
169
- ];
170
-
171
- while (buttons.length > 0) {
172
- const row = new ActionRowBuilder<ButtonBuilder>();
173
- for (let i = 0; i < 5 && buttons.length > 0; i++) {
174
- const { id, settings } = buttons.shift()!;
175
- if (settings) {
176
- row.addComponents(this.createButton(id, settings));
177
- }
178
- }
179
- rows.push(row);
180
- }
181
-
182
- return rows;
134
+
135
+ private createButtons(): ButtonBuilder[] {
136
+ const {
137
+ nextAndBack,
138
+ firstAndLast,
139
+ homeStyle,
140
+ deleteStyle,
141
+ } = this.options.style;
142
+
143
+ const {
144
+ emojiNext,
145
+ emojiBack,
146
+ emojiFirst,
147
+ emojiLast,
148
+ emojiHome,
149
+ emojiDelete,
150
+ } = this.options.emoji;
151
+
152
+ const next = new ButtonBuilder().setCustomId(CUSTOM_IDS.NEXT).setEmoji(emojiNext!).setStyle(nextAndBack!);
153
+ const back = new ButtonBuilder().setCustomId(CUSTOM_IDS.BACK).setEmoji(emojiBack!).setStyle(nextAndBack!);
154
+ const first = new ButtonBuilder().setCustomId(CUSTOM_IDS.FIRST).setEmoji(emojiFirst!).setStyle(firstAndLast!);
155
+ const last = new ButtonBuilder().setCustomId(CUSTOM_IDS.LAST).setEmoji(emojiLast!).setStyle(firstAndLast!);
156
+ const home = new ButtonBuilder().setCustomId(CUSTOM_IDS.HOME).setEmoji(emojiHome!).setStyle(homeStyle!);
157
+ const deleteBtn = new ButtonBuilder().setCustomId(CUSTOM_IDS.DELETE).setEmoji(emojiDelete!).setStyle(deleteStyle!);
158
+
159
+ const {
160
+ labelNext,
161
+ labelBack,
162
+ labelFirst,
163
+ labelLast,
164
+ labelHome,
165
+ labelDelete,
166
+ } = this.options.label;
167
+
168
+ if (labelNext) next.setLabel(labelNext);
169
+ if (labelBack) back.setLabel(labelBack);
170
+ if (labelFirst) first.setLabel(labelFirst);
171
+ if (labelLast) last.setLabel(labelLast);
172
+ if (labelHome) home.setLabel(labelHome);
173
+ if (labelDelete) deleteBtn.setLabel(labelDelete);
174
+
175
+ const buttons: ButtonBuilder[] = [];
176
+
177
+ if (this.options.firstLast) buttons.push(first);
178
+ buttons.push(back);
179
+ if (this.options.home?.home_Option) buttons.push(home);
180
+ else if (this.options.deleteOption) buttons.push(deleteBtn);
181
+ buttons.push(next);
182
+ if (this.options.firstLast) buttons.push(last);
183
+
184
+ return buttons;
183
185
  }
184
-
185
- private splitComponentsIntoRows(components: ButtonBuilder[]): ButtonBuilder[][] {
186
- const rows: ButtonBuilder[][] = [];
187
- while (components.length > 0) {
188
- rows.push(components.splice(0, 5));
186
+
187
+ private createComponents(): ActionRowBuilder<MessageActionRowComponentBuilder>[] {
188
+ const buttonRow = new ActionRowBuilder<MessageActionRowComponentBuilder>().addComponents(this.buttons);
189
+
190
+ const otherRows = this.options.otherComponents || [];
191
+ const selectMenus = this.options.navigationMenu?.enabled ? this.createSelectMenus() : [];
192
+
193
+ return [buttonRow, ...selectMenus, ...otherRows];
194
+ }
195
+
196
+ private createSelectMenus(): ActionRowBuilder<StringSelectMenuBuilder>[] {
197
+ const { embeds = [], content = [], attachment = [] } = this.options.pages || {};
198
+ const longest_length = Math.max(embeds.length, content.length, attachment.length);
199
+ const selectMenus: ActionRowBuilder<StringSelectMenuBuilder>[] = [];
200
+ const select_status = this.options.navigationMenu?.enabled;
201
+ const select_placeholder = this.options.navigationMenu?.placeHolder;
202
+ const selects = this.options.navigationMenu?.selects || [];
203
+
204
+ if (select_status) {
205
+ for (let i = 0; i < longest_length; i += 25) {
206
+ const menuOptions = Array.from({ length: Math.min(25, longest_length - i) }, (_, j) => ({
207
+ label: selects[i + j] ? selects[i + j] : `Page ${i + j + 1}`,
208
+ value: `${i + j}`
209
+ }));
210
+
211
+ const selectMenu = new StringSelectMenuBuilder()
212
+ .setCustomId(`select_${i}`)
213
+ .setPlaceholder(select_placeholder || "Choose a page")
214
+ .addOptions(menuOptions);
215
+
216
+ selectMenus.push(new ActionRowBuilder<StringSelectMenuBuilder>().addComponents(selectMenu));
217
+ }
189
218
  }
190
- return rows;
191
- }
192
-
193
- private createButton(id: string, settings?: ButtonSettings): ButtonBuilder {
194
- const button = new ButtonBuilder()
195
- .setCustomId(id)
196
- .setLabel(settings?.label ?? '')
197
- .setStyle(settings?.style ?? ButtonStyle.Secondary);
198
-
199
- if (settings?.emoji) {
200
- button.setEmoji(settings.emoji);
219
+
220
+ return selectMenus;
221
+ }
222
+
223
+ public async send() {
224
+ const { embeds = [], content = [], attachment = [] } = this.options.pages || {};
225
+
226
+ if (embeds.length === 0) {
227
+ throw new Error("No embeds provided.");
201
228
  }
202
-
203
- return button;
204
- }
205
-
206
- private getEmbed(): EmbedBuilder {
207
- return this.embedOptions.dynamicUpdate
208
- ? this.embedOptions.dynamicUpdate(this.embedOptions.defaultPage)
209
- : this.embedOptions.embeds[this.embedOptions.defaultPage];
210
- }
211
-
212
- private async handleInteraction(interaction: ButtonInteraction | StringSelectMenuInteraction): Promise<void> {
213
- if (this.restrictToUser && interaction.user.id !== this.restrictToUser) {
214
- await interaction.reply({ content: "You can't use these buttons!", ephemeral: true });
215
- return;
229
+
230
+ try {
231
+ const msg = await this.message.reply({
232
+ embeds: [embeds[0]],
233
+ content: content[0] || "",
234
+ files: attachment[0] ? [attachment[0]] : [],
235
+ components: this.components,
236
+ });
237
+
238
+ const collector = this.createCollector(msg);
239
+ collector.on("collect", async (i: MessageComponentInteraction) => this.handleCollect(i));
240
+ collector.on("end", async () => this.handleEnd(msg));
241
+ } catch (error) {
242
+ console.error("Error sending message:", error);
216
243
  }
217
-
218
- const { customId, values } = interaction as any;
219
-
220
- const buttonAction = this.buttonSettings[customId as keyof typeof this.buttonSettings]?.onClick;
221
- if (buttonAction) {
222
- buttonAction();
223
- }
224
-
225
- switch (customId) {
226
- case 'first-djs-builder':
227
- this.embedOptions.defaultPage = 0;
228
- break;
229
- case 'previous-djs-builder':
230
- this.embedOptions.defaultPage = this.loopNavigation && this.embedOptions.defaultPage === 0
231
- ? this.embedOptions.embeds.length - 1
232
- : Math.max(this.embedOptions.defaultPage - 1, 0);
233
- break;
234
- case 'next-djs-builder':
235
- this.embedOptions.defaultPage = this.loopNavigation && this.embedOptions.defaultPage === this.embedOptions.embeds.length - 1
236
- ? 0
237
- : Math.min(this.embedOptions.defaultPage + 1, this.embedOptions.embeds.length - 1);
244
+ }
245
+
246
+ private createCollector(msg: Message) {
247
+ const filter = this.options.user_only?.user_status
248
+ ? async (i: MessageComponentInteraction) => {
249
+ if (i.user.id !== this.message.author.id) {
250
+ await i.reply({ content: this.options.user_only.reply!, ephemeral: true });
251
+ return false;
252
+ }
253
+ return true;
254
+ }
255
+ : undefined;
256
+
257
+ return msg.createMessageComponentCollector({
258
+ filter,
259
+ time: this.options.timeOption?.timeOut || 86400000,
260
+ });
261
+ }
262
+
263
+ private async handleCollect(i: MessageComponentInteraction) {
264
+ const { embeds = [], content = [], attachment = [] } = this.options.pages || {};
265
+ const num = embeds.length;
266
+
267
+ try {
268
+ if (i.isButton()) {
269
+ switch (i.customId) {
270
+ case CUSTOM_IDS.NEXT:
271
+ this.naw_page = (this.naw_page + 1) % num;
238
272
  break;
239
- case 'last-djs-builder':
240
- this.embedOptions.defaultPage = this.embedOptions.embeds.length - 1;
273
+ case CUSTOM_IDS.BACK:
274
+ this.naw_page = (this.naw_page - 1 + num) % num;
241
275
  break;
242
- case 'home-djs-builder':
243
- this.embedOptions.defaultPage = this.embedOptions.homePage;
276
+ case CUSTOM_IDS.FIRST:
277
+ this.naw_page = 0;
244
278
  break;
245
- case 'select-djs-builder':
246
- this.embedOptions.defaultPage = parseInt(values[0], 10);
279
+ case CUSTOM_IDS.LAST:
280
+ this.naw_page = num - 1;
247
281
  break;
248
- default:
282
+ case CUSTOM_IDS.DELETE:
283
+ await i.message.delete();
284
+ return;
285
+ case CUSTOM_IDS.HOME:
286
+ this.naw_page = this.options.home?.home_page || 0;
249
287
  break;
250
- }
251
-
252
- if (this.message) {
253
- await interaction.deferUpdate();
254
- await this.message.edit({
255
- embeds: [this.getEmbed()],
256
- components: this.components,
257
- content: this.content ?? undefined,
258
- files: this.attachments.length ? this.attachments : undefined,
259
- });
260
- } else if (this.channel) {
261
- this.message = await this.channel.send({
262
- embeds: [this.getEmbed()],
263
- components: this.components,
264
- content: this.content ?? undefined,
265
- files: this.attachments.length ? this.attachments : undefined,
266
- });
267
- this.createCollector(this.message);
268
- } else if (this.context) {
269
- // @ts-ignore
270
- this.message = await this.context.reply({
271
- embeds: [this.getEmbed()],
272
- components: this.components,
273
- content: this.content ?? undefined,
274
- files: this.attachments.length ? this.attachments : undefined,
275
- }) as Message;
276
- // @ts-ignore
277
- this.message = await this.context.fetchReply() as Message;
278
- this.createCollector(this.message);
279
- } else {
280
- throw new Error('You must specify either a context or a channel.');
281
- }
282
- }
283
-
284
- public async send(): Promise<void> {
285
- if (this.context || this.channel) {
286
- // @ts-ignore
287
- await this.handleInteraction({ customId: '', values: [] } as ButtonInteraction);
288
- } else {
289
- throw new Error('You must specify either a context or a channel.');
290
- }
291
- }
292
-
293
- private createCollector(message: Message): void {
294
- const collector = message.createMessageComponentCollector({
295
- filter: (i) => i.isButton() || i.isStringSelectMenu(),
296
- time: this.timeoutOptions.duration,
297
- });
298
-
299
- collector.on('collect', async (interaction) => {
300
- if (interaction.isButton() || interaction.isStringSelectMenu()) {
301
- await this.handleInteraction(interaction);
302
- }
303
- });
304
-
305
- collector.on('end', async () => {
306
- if (this.timeoutOptions.onTimeout) {
307
- this.timeoutOptions.onTimeout();
308
288
  }
309
- if (!this.timeoutOptions.disableComponents) {
310
- await message.edit({ components: [] });
311
- } else {
312
- await message.edit({
313
- // @ts-ignore
314
- components: this.components.map((row) =>
315
- row.components.map((component) => component.setDisabled(true))
316
- ),
317
- });
289
+ } else if (i.isStringSelectMenu()) {
290
+ if (i.customId === "select-djs-builder") {
291
+ this.naw_page = parseInt(i.values[0], 10);
318
292
  }
319
- });
293
+ }
294
+ await i.update({
295
+ embeds: [embeds[this.naw_page]],
296
+ content: content[this.naw_page] || "",
297
+ files: attachment[this.naw_page] ? [attachment[this.naw_page]] : [],
298
+ components: this.createComponents(),
299
+ });
300
+ } catch (error) {
301
+ console.error("Error handling interaction:", error);
302
+ }
303
+ }
304
+
305
+ private async handleEnd(msg: Message) {
306
+ try {
307
+ if (this.options.timeOption?.disable) {
308
+ this.components[0].components.forEach((button) => button.setDisabled(true));
309
+ await msg.edit({ components: this.components });
310
+ }
311
+ if (this.options.timeOption?.deletes) {
312
+ await msg.edit({ components: [] });
313
+ }
314
+ if (typeof this.options.timeOption?.custom === "function") {
315
+ this.options.timeOption.custom();
316
+ }
317
+ } catch (error) {
318
+ console.error("Error handling end of collector:", error);
319
+ }
320
+ }
320
321
  }
321
- }
322
+
@@ -123,6 +123,7 @@ export async function loadEvents(client: any, eventsOptions: EventsOptions) {
123
123
 
124
124
  const eventCount = await countEventFiles(eventsOptions.path, eventsOptions);
125
125
  client.eventSize = eventCount;
126
+
126
127
  } catch (error: any) {
127
128
  logError(`Error while loading events from path: ${eventsOptions.path}`);
128
129
  logError(error.message, error);