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,24 +1,116 @@
1
- import { Collection, Routes, resolveImage, ActivityType } from 'discord.js';
1
+ import { Collection, Routes, resolveImage, ActivityType, Client } from 'discord.js';
2
2
  import { StarterOptions } from '../types/starter';
3
3
  import { loadPrefix } from './prefix-responder';
4
4
  import { loadSlash } from './slash-responder';
5
5
  import { readCommands } from './prefix-register';
6
-
7
- export const botData = new Collection<string, string | string[]>();
6
+ import { GatewayIntentBits } from 'discord-api-types/v10';
7
+ import { logError, logInfo, logWarning } from '../utils';
8
8
  import * as path from 'path';
9
9
  import fs from 'fs';
10
- export async function login(djs: any, options: StarterOptions) {
10
+
11
+ export const botData = new Collection<string, string | string[]>();
12
+
13
+ export async function login(djs: Client & { botData?: Collection<string, string | string[]>; botInfo?: any; ownerId?: string }, options: StarterOptions) {
11
14
 
12
15
  if (!djs) {
13
16
  throw new Error("⚠️ \x1b[31mMissing client parameter. Please provide a valid Discord client.\x1b[0m");
14
17
  }
18
+
19
+ djs.on('rateLimit', (rateLimitInfo) => {
20
+ logWarning(`Rate limit hit: ${rateLimitInfo.timeout}ms timeout for ${rateLimitInfo.limit} requests.`);
21
+ logInfo(`Route: ${rateLimitInfo.route}`);
22
+ });
23
+
24
+ djs.on('error', (error) => {
25
+ logError('An error occurred', error);
26
+ });
27
+
15
28
  if (options.bot.token) {
16
29
  try {
17
30
  await djs.login(options.bot.token);
18
31
 
19
32
  if (options.bot?.token) botData.set('botToken', options.bot.token);
20
- } catch (error) {
21
- console.error("⚠️ \x1b[31mInvalid token provided. Please provide a valid bot token\x1b[0m");
33
+
34
+ const REQUIRED_INTENTS = {
35
+ 'guildCreate': GatewayIntentBits.Guilds,
36
+ 'guildUpdate': GatewayIntentBits.Guilds,
37
+ 'guildDelete': GatewayIntentBits.Guilds,
38
+ 'channelCreate': GatewayIntentBits.Guilds,
39
+ 'channelUpdate': GatewayIntentBits.Guilds,
40
+ 'channelDelete': GatewayIntentBits.Guilds,
41
+ 'channelPinsUpdate': GatewayIntentBits.Guilds,
42
+ 'threadCreate': GatewayIntentBits.Guilds,
43
+ 'threadUpdate': GatewayIntentBits.Guilds,
44
+ 'threadDelete': GatewayIntentBits.Guilds,
45
+ 'threadListSync': GatewayIntentBits.Guilds,
46
+ 'threadMemberUpdate': GatewayIntentBits.Guilds,
47
+ 'threadMembersUpdate': GatewayIntentBits.Guilds,
48
+ 'stageInstanceCreate': GatewayIntentBits.Guilds,
49
+ 'stageInstanceUpdate': GatewayIntentBits.Guilds,
50
+ 'stageInstanceDelete': GatewayIntentBits.Guilds,
51
+ 'guildMemberAdd': GatewayIntentBits.GuildMembers,
52
+ 'guildMemberUpdate': GatewayIntentBits.GuildMembers,
53
+ 'guildMemberRemove': GatewayIntentBits.GuildMembers,
54
+ 'guildAuditLogEntryCreate': GatewayIntentBits.GuildModeration,
55
+ 'guildBanAdd': GatewayIntentBits.GuildModeration,
56
+ 'guildBanRemove': GatewayIntentBits.GuildModeration,
57
+ 'guildEmojisUpdate': GatewayIntentBits.GuildEmojisAndStickers,
58
+ 'guildStickersUpdate': GatewayIntentBits.GuildEmojisAndStickers,
59
+ 'guildIntegrationsUpdate': GatewayIntentBits.GuildIntegrations,
60
+ 'integrationCreate': GatewayIntentBits.GuildIntegrations,
61
+ 'integrationUpdate': GatewayIntentBits.GuildIntegrations,
62
+ 'integrationDelete': GatewayIntentBits.GuildIntegrations,
63
+ 'webhooksUpdate': GatewayIntentBits.GuildWebhooks,
64
+ 'inviteCreate': GatewayIntentBits.GuildInvites,
65
+ 'inviteDelete': GatewayIntentBits.GuildInvites,
66
+ 'voiceStateUpdate': GatewayIntentBits.GuildVoiceStates,
67
+ 'presenceUpdate': GatewayIntentBits.GuildPresences,
68
+ 'messageCreate': GatewayIntentBits.GuildMessages | GatewayIntentBits.DirectMessages,
69
+ 'messageUpdate': GatewayIntentBits.GuildMessages | GatewayIntentBits.DirectMessages,
70
+ 'messageDelete': GatewayIntentBits.GuildMessages | GatewayIntentBits.DirectMessages,
71
+ 'messageDeleteBulk': GatewayIntentBits.GuildMessages,
72
+ 'messageReactionAdd': GatewayIntentBits.GuildMessageReactions,
73
+ 'messageReactionRemove': GatewayIntentBits.GuildMessageReactions,
74
+ 'messageReactionRemoveAll': GatewayIntentBits.GuildMessageReactions,
75
+ 'messageReactionRemoveEmoji': GatewayIntentBits.GuildMessageReactions,
76
+ 'typingStart': GatewayIntentBits.GuildMessageTyping,
77
+ 'guildScheduledEventCreate': GatewayIntentBits.GuildScheduledEvents,
78
+ 'guildScheduledEventUpdate': GatewayIntentBits.GuildScheduledEvents,
79
+ 'guildScheduledEventDelete': GatewayIntentBits.GuildScheduledEvents,
80
+ 'guildScheduledEventUserAdd': GatewayIntentBits.GuildScheduledEvents,
81
+ 'guildScheduledEventUserRemove': GatewayIntentBits.GuildScheduledEvents,
82
+ 'autoModerationRuleCreate': GatewayIntentBits.AutoModerationConfiguration,
83
+ 'autoModerationRuleUpdate': GatewayIntentBits.AutoModerationConfiguration,
84
+ 'autoModerationRuleDelete': GatewayIntentBits.AutoModerationConfiguration,
85
+ 'autoModerationActionExecution': GatewayIntentBits.AutoModerationExecution,
86
+ 'messagePollVoteAdd': GatewayIntentBits.GuildMessagePolls,
87
+ 'messagePollVoteRemove': GatewayIntentBits.GuildMessagePolls
88
+ };
89
+
90
+ const missingIntents = new Set();
91
+ const intents = Number(djs.options.intents.bitfield);
92
+ for (const eventName of Object.keys((djs as any)._events)) {
93
+ const requiredBit = REQUIRED_INTENTS[eventName as keyof typeof REQUIRED_INTENTS];
94
+ if (!requiredBit) continue;
95
+ if ((intents & requiredBit) === 0) {
96
+ missingIntents.add(requiredBit);
97
+ }
98
+ }
99
+
100
+ if (missingIntents.size > 0) {
101
+ const EventNames: { [key: number]: string } = Object.fromEntries(
102
+ Object.entries(GatewayIntentBits).map(([key, value]) => [value, key])
103
+ );
104
+
105
+ const missingIntentNames = [...missingIntents].map(bit => {
106
+ return EventNames[bit as keyof typeof EventNames] ?? 'unknown';
107
+ });
108
+
109
+ logError(`Missing intents: ${missingIntentNames.join(', ')}`);
110
+ }
111
+
112
+ } catch (error: any) {
113
+ logError("⚠️ \x1b[31mInvalid token provided. Please provide a valid bot token\x1b[0m", error);
22
114
  process.exit(1);
23
115
  }
24
116
  }
@@ -91,7 +183,7 @@ export async function login(djs: any, options: StarterOptions) {
91
183
  }
92
184
 
93
185
 
94
- const userChosenType = options.bot.Status?.type || 3;
186
+ const userChosenType = options.bot.Status ? options.bot.Status.type : 3;
95
187
  if (options.bot.Status?.activities) {
96
188
  if (options.bot.Status.activities.length >= 1) {
97
189
  const initialActivity = options.bot.Status.activities[0];
@@ -115,7 +207,7 @@ export async function login(djs: any, options: StarterOptions) {
115
207
  let delay = 60000;
116
208
  if (options.bot.Status.delay !== undefined) {
117
209
  if (options.bot.Status.delay < 60000) {
118
- console.warn('⚠️ \x1b[31mDelay must be at least 1 minute.\x1b[0m');
210
+ logWarning('⚠️ Delay must be at least 1 minute.');
119
211
  }
120
212
  delay = options.bot.Status.delay;
121
213
  }
@@ -135,8 +227,8 @@ export async function login(djs: any, options: StarterOptions) {
135
227
  status: options.bot.Status?.state,
136
228
  });
137
229
  }
138
- } catch (error) {
139
- console.error(`Error setting activity: ${error}`);
230
+ } catch (error: any) {
231
+ logError("Error setting activity: ${error}", error);
140
232
  }
141
233
  }, delay);
142
234
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "djs-builder",
3
- "version": "0.5.10",
3
+ "version": "0.5.31",
4
4
  "description": "Discord.js bot builder. Supports Ts and Js.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,65 +0,0 @@
1
- import { ActionRowBuilder, EmbedBuilder, ButtonStyle, TextChannel, Interaction } from 'discord.js';
2
- interface ButtonSettings {
3
- label: string;
4
- style: ButtonStyle;
5
- emoji?: string;
6
- onClick?: () => void;
7
- }
8
- interface EmbedOptions {
9
- homePage: number;
10
- embeds: EmbedBuilder[];
11
- defaultPage: number;
12
- dynamicUpdate?: (currentPage: number) => EmbedBuilder;
13
- }
14
- interface TimeoutOptions {
15
- duration: number;
16
- disableComponents: boolean;
17
- onTimeout?: () => void;
18
- }
19
- interface PaginationOptions {
20
- embedOptions: EmbedOptions;
21
- timeoutOptions?: TimeoutOptions;
22
- restrictToUser?: string | null;
23
- navigationMenu?: boolean;
24
- loopNavigation?: boolean;
25
- buttonSettings?: {
26
- first?: ButtonSettings;
27
- previous?: ButtonSettings;
28
- home?: ButtonSettings;
29
- next?: ButtonSettings;
30
- last?: ButtonSettings;
31
- };
32
- additionalComponents?: ActionRowBuilder<any>[];
33
- attachments?: any[];
34
- content?: string;
35
- channel?: TextChannel;
36
- context?: Interaction;
37
- autoRefresh?: {
38
- interval: number;
39
- updateContent: () => void;
40
- };
41
- }
42
- export declare class Pagination {
43
- private embedOptions;
44
- private timeoutOptions;
45
- private restrictToUser;
46
- private navigationMenu;
47
- private loopNavigation;
48
- private buttonSettings;
49
- private additionalComponents;
50
- private attachments;
51
- private content;
52
- private channel?;
53
- private context?;
54
- private components;
55
- private message?;
56
- private autoRefresh?;
57
- constructor({ embedOptions, timeoutOptions, restrictToUser, navigationMenu, loopNavigation, buttonSettings, additionalComponents, attachments, content, channel, context, autoRefresh, }: PaginationOptions);
58
- private createButton;
59
- private getEmbed;
60
- private handleInteraction;
61
- send(): Promise<void>;
62
- private createCollector;
63
- }
64
- export {};
65
- //# sourceMappingURL=Pagination.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Pagination.d.ts","sourceRoot":"","sources":["../../../../lib/discord/builder/components/Pagination.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,gBAAgB,EAEhB,YAAY,EACZ,WAAW,EAEX,WAAW,EAEX,WAAW,EAGd,MAAM,YAAY,CAAC;AAEpB,UAAU,cAAc;IACpB,KAAK,EAAE,MAAM,CAAC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C,OAAO,CAAC,cAAc,CAAiB;IACvC,OAAO,CAAC,cAAc,CAAgB;IACtC,OAAO,CAAC,cAAc,CAAU;IAChC,OAAO,CAAC,cAAc,CAAU;IAChC,OAAO,CAAC,cAAc,CAMpB;IACF,OAAO,CAAC,oBAAoB,CAA0B;IACtD,OAAO,CAAC,WAAW,CAAQ;IAC3B,OAAO,CAAC,OAAO,CAAgB;IAC/B,OAAO,CAAC,OAAO,CAAC,CAAc;IAC9B,OAAO,CAAC,OAAO,CAAC,CAAc;IAC9B,OAAO,CAAC,UAAU,CAA0B;IAC5C,OAAO,CAAC,OAAO,CAAC,CAAU;IAC1B,OAAO,CAAC,WAAW,CAAC,CAGlB;gBAEU,EACR,YAAY,EACZ,cAA6D,EAC7D,cAAqB,EACrB,cAAsB,EACtB,cAAqB,EACrB,cAMC,EACD,oBAAyB,EACzB,WAAgB,EAChB,OAAY,EACZ,OAAO,EACP,OAAO,EACP,WAAW,GACd,EAAE,iBAAiB;IA4DpB,OAAO,CAAC,YAAY;IAapB,OAAO,CAAC,QAAQ;YAMF,iBAAiB;IAwElB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IASlC,OAAO,CAAC,eAAe;CA4B1B"}
@@ -1,189 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Pagination = void 0;
4
- const discord_js_1 = require("discord.js");
5
- class Pagination {
6
- embedOptions;
7
- timeoutOptions;
8
- restrictToUser;
9
- navigationMenu;
10
- loopNavigation;
11
- buttonSettings;
12
- additionalComponents;
13
- attachments;
14
- content;
15
- channel;
16
- context;
17
- components;
18
- message;
19
- autoRefresh;
20
- constructor({ embedOptions, timeoutOptions = { duration: 60000, disableComponents: true }, restrictToUser = null, navigationMenu = false, loopNavigation = true, buttonSettings = {
21
- first: { label: 'First', style: discord_js_1.ButtonStyle.Primary },
22
- previous: { label: 'Previous', style: discord_js_1.ButtonStyle.Secondary },
23
- home: { label: 'Home', style: discord_js_1.ButtonStyle.Success },
24
- next: { label: 'Next', style: discord_js_1.ButtonStyle.Secondary },
25
- last: { label: 'Last', style: discord_js_1.ButtonStyle.Primary },
26
- }, additionalComponents = [], attachments = [], content = '', channel, context, autoRefresh, }) {
27
- // Validate the number of embeds for the navigation menu
28
- if (navigationMenu && (embedOptions.embeds.length < 1 || embedOptions.embeds.length > 25)) {
29
- throw new Error('The number of embeds must be between 1 and 25 to use the navigation menu.');
30
- }
31
- this.embedOptions = embedOptions;
32
- this.timeoutOptions = timeoutOptions;
33
- this.restrictToUser = restrictToUser;
34
- this.navigationMenu = navigationMenu;
35
- this.loopNavigation = loopNavigation;
36
- this.buttonSettings = buttonSettings;
37
- this.additionalComponents = additionalComponents;
38
- this.attachments = attachments;
39
- this.content = content;
40
- this.channel = channel;
41
- this.context = context;
42
- this.autoRefresh = autoRefresh;
43
- this.components = [
44
- new discord_js_1.ActionRowBuilder().addComponents(this.createButton('first', this.buttonSettings.first), this.createButton('previous', this.buttonSettings.previous), this.createButton('home', this.buttonSettings.home), this.createButton('next', this.buttonSettings.next), this.createButton('last', this.buttonSettings.last)),
45
- ];
46
- if (this.navigationMenu) {
47
- this.components.push(new discord_js_1.ActionRowBuilder().addComponents(new discord_js_1.StringSelectMenuBuilder()
48
- .setCustomId('select')
49
- .setPlaceholder('Select a page')
50
- .addOptions(this.embedOptions.embeds.map((_, index) => ({
51
- label: `Page ${index + 1}`,
52
- value: index.toString(),
53
- })))));
54
- }
55
- if (this.additionalComponents.length > 0) {
56
- this.components.push(...this.additionalComponents);
57
- }
58
- if (this.autoRefresh) {
59
- setInterval(() => {
60
- this.autoRefresh.updateContent();
61
- this.message?.edit({
62
- embeds: [this.getEmbed()],
63
- components: this.components,
64
- });
65
- }, this.autoRefresh.interval);
66
- }
67
- }
68
- createButton(id, settings) {
69
- const button = new discord_js_1.ButtonBuilder()
70
- .setCustomId(id)
71
- .setLabel(settings?.label ?? '')
72
- .setStyle(settings?.style ?? discord_js_1.ButtonStyle.Secondary);
73
- if (settings?.emoji) {
74
- button.setEmoji(settings.emoji);
75
- }
76
- return button;
77
- }
78
- getEmbed() {
79
- return this.embedOptions.dynamicUpdate
80
- ? this.embedOptions.dynamicUpdate(this.embedOptions.defaultPage)
81
- : this.embedOptions.embeds[this.embedOptions.defaultPage];
82
- }
83
- async handleInteraction(interaction) {
84
- if (this.restrictToUser && interaction.user.id !== this.restrictToUser) {
85
- await interaction.reply({ content: "You can't use these buttons!", ephemeral: true });
86
- return;
87
- }
88
- const { customId, values } = interaction;
89
- const buttonAction = this.buttonSettings[customId]?.onClick;
90
- if (buttonAction) {
91
- buttonAction();
92
- }
93
- switch (customId) {
94
- case 'first':
95
- this.embedOptions.defaultPage = 0;
96
- break;
97
- case 'previous':
98
- this.embedOptions.defaultPage = this.loopNavigation && this.embedOptions.defaultPage === 0
99
- ? this.embedOptions.embeds.length - 1
100
- : Math.max(this.embedOptions.defaultPage - 1, 0);
101
- break;
102
- case 'next':
103
- this.embedOptions.defaultPage = this.loopNavigation && this.embedOptions.defaultPage === this.embedOptions.embeds.length - 1
104
- ? 0
105
- : Math.min(this.embedOptions.defaultPage + 1, this.embedOptions.embeds.length - 1);
106
- break;
107
- case 'last':
108
- this.embedOptions.defaultPage = this.embedOptions.embeds.length - 1;
109
- break;
110
- case 'home':
111
- this.embedOptions.defaultPage = this.embedOptions.homePage;
112
- break;
113
- case 'select':
114
- this.embedOptions.defaultPage = parseInt(values[0], 10);
115
- break;
116
- default:
117
- break;
118
- }
119
- if (this.message) {
120
- await interaction.deferUpdate();
121
- await this.message.edit({
122
- embeds: [this.getEmbed()],
123
- components: this.components,
124
- content: this.content ?? undefined,
125
- files: this.attachments.length ? this.attachments : undefined,
126
- });
127
- }
128
- else if (this.channel) {
129
- this.message = await this.channel.send({
130
- embeds: [this.getEmbed()],
131
- components: this.components,
132
- content: this.content ?? undefined,
133
- files: this.attachments.length ? this.attachments : undefined,
134
- });
135
- this.createCollector(this.message);
136
- }
137
- else if (this.context) {
138
- // @ts-ignore
139
- this.message = await this.context.reply({
140
- embeds: [this.getEmbed()],
141
- components: this.components,
142
- content: this.content ?? undefined,
143
- files: this.attachments.length ? this.attachments : undefined,
144
- });
145
- // @ts-ignore
146
- this.message = await this.context.fetchReply();
147
- this.createCollector(this.message);
148
- }
149
- else {
150
- throw new Error('You must specify either a context or a channel.');
151
- }
152
- }
153
- async send() {
154
- if (this.context || this.channel) {
155
- // @ts-ignore
156
- await this.handleInteraction({ customId: '', values: [] });
157
- }
158
- else {
159
- throw new Error('You must specify either a context or a channel.');
160
- }
161
- }
162
- createCollector(message) {
163
- const collector = message.createMessageComponentCollector({
164
- filter: (i) => i.isButton() || i.isStringSelectMenu(),
165
- time: this.timeoutOptions.duration,
166
- });
167
- collector.on('collect', async (interaction) => {
168
- if (interaction.isButton() || interaction.isStringSelectMenu()) {
169
- await this.handleInteraction(interaction);
170
- }
171
- });
172
- collector.on('end', async () => {
173
- if (this.timeoutOptions.onTimeout) {
174
- this.timeoutOptions.onTimeout();
175
- }
176
- if (!this.timeoutOptions.disableComponents) {
177
- await message.edit({ components: [] });
178
- }
179
- else {
180
- await message.edit({
181
- // @ts-ignore
182
- components: this.components.map((row) => row.components.map((component) => component.setDisabled(true))),
183
- });
184
- }
185
- });
186
- }
187
- }
188
- exports.Pagination = Pagination;
189
- //# sourceMappingURL=Pagination.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Pagination.js","sourceRoot":"","sources":["../../../../lib/discord/builder/components/Pagination.ts"],"names":[],"mappings":";;;AAAA,2CAWoB;AA8CpB,MAAa,UAAU;IACX,YAAY,CAAe;IAC3B,cAAc,CAAiB;IAC/B,cAAc,CAAgB;IAC9B,cAAc,CAAU;IACxB,cAAc,CAAU;IACxB,cAAc,CAMpB;IACM,oBAAoB,CAA0B;IAC9C,WAAW,CAAQ;IACnB,OAAO,CAAgB;IACvB,OAAO,CAAe;IACtB,OAAO,CAAe;IACtB,UAAU,CAA0B;IACpC,OAAO,CAAW;IAClB,WAAW,CAGjB;I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,WAAW,EAAE,EAAE;YAC1C,IAAI,WAAW,CAAC,QAAQ,EAAE,IAAI,WAAW,CAAC,kBAAkB,EAAE,EAAE,CAAC;gBAC7D,MAAM,IAAI,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC;YAC9C,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,IAAI,EAAE;YAC3B,IAAI,IAAI,CAAC,cAAc,CAAC,SAAS,EAAE,CAAC;gBAChC,IAAI,CAAC,cAAc,CAAC,SAAS,EAAE,CAAC;YACpC,CAAC;YACD,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,iBAAiB,EAAE,CAAC;gBACzC,MAAM,OAAO,CAAC,IAAI,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,CAAC;YAC3C,CAAC;iBAAM,CAAC;gBACJ,MAAM,OAAO,CAAC,IAAI,CAAC;oBACf,aAAa;oBACb,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CACpC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CACjE;iBACJ,CAAC,CAAC;YACP,CAAC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AAxOD,gCAwOC"}
@@ -1,3 +0,0 @@
1
- import { EventsOptions } from '../types/starter';
2
- export declare function eventsLoader(client: any, eventsOptions: EventsOptions): Promise<boolean>;
3
- //# sourceMappingURL=events%20loader.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"events loader.d.ts","sourceRoot":"","sources":["../../../lib/discord/events-handler/events loader.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,wBAAsB,YAAY,CAAC,MAAM,EAAE,GAAG,EAAE,aAAa,EAAE,aAAa,oBAiB3E"}
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.eventsLoader = eventsLoader;
4
- const logger_1 = require("../functions/logger");
5
- const events_1 = require("./events");
6
- async function eventsLoader(client, eventsOptions) {
7
- client.eventSize = 0;
8
- client.removeAllListeners();
9
- (0, logger_1.logInfo)(`Reloading events from ${eventsOptions.path}`);
10
- try {
11
- await (0, events_1.loadEvents)(client, eventsOptions);
12
- (0, logger_1.logSuccess)(`Successfully reloaded ${client.eventSize} events.`);
13
- return true;
14
- }
15
- catch (error) {
16
- (0, logger_1.logError)(`Error reloading events: ${error.message}`);
17
- return false;
18
- }
19
- }
20
- //# sourceMappingURL=events%20loader.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"events loader.js","sourceRoot":"","sources":["../../../lib/discord/events-handler/events loader.ts"],"names":[],"mappings":";;AAGA,oCAiBC;AApBD,gDAAoE;AAEpE,qCAAsC;AAC/B,KAAK,UAAU,YAAY,CAAC,MAAW,EAAE,aAA4B;IAExE,MAAM,CAAC,SAAS,GAAG,CAAC,CAAC;IACrB,MAAM,CAAC,kBAAkB,EAAE,CAAC;IAE5B,IAAA,gBAAO,EAAC,yBAAyB,aAAa,CAAC,IAAI,EAAE,CAAC,CAAC;IAEvD,IAAI,CAAC;QAED,MAAM,IAAA,mBAAU,EAAC,MAAM,EAAE,aAAa,CAAC,CAAC;QAExC,IAAA,mBAAU,EAAC,yBAAyB,MAAM,CAAC,SAAS,UAAU,CAAC,CAAC;QAChE,OAAO,IAAI,CAAA;IACf,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QAClB,IAAA,iBAAQ,EAAC,2BAA2B,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QACrD,OAAO,KAAK,CAAA;IAChB,CAAC;AACL,CAAC"}