djs-builder 0.5.20 → 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.
@@ -32,21 +32,102 @@ const discord_js_1 = require("discord.js");
32
32
  const prefix_responder_1 = require("./prefix-responder");
33
33
  const slash_responder_1 = require("./slash-responder");
34
34
  const prefix_register_1 = require("./prefix-register");
35
- exports.botData = new discord_js_1.Collection();
35
+ const v10_1 = require("discord-api-types/v10");
36
+ const utils_1 = require("../utils");
36
37
  const path = __importStar(require("path"));
37
38
  const fs_1 = __importDefault(require("fs"));
39
+ exports.botData = new discord_js_1.Collection();
38
40
  async function login(djs, options) {
39
41
  if (!djs) {
40
42
  throw new Error("⚠️ \x1b[31mMissing client parameter. Please provide a valid Discord client.\x1b[0m");
41
43
  }
44
+ djs.on('rateLimit', (rateLimitInfo) => {
45
+ (0, utils_1.logWarning)(`Rate limit hit: ${rateLimitInfo.timeout}ms timeout for ${rateLimitInfo.limit} requests.`);
46
+ (0, utils_1.logInfo)(`Route: ${rateLimitInfo.route}`);
47
+ });
48
+ djs.on('error', (error) => {
49
+ (0, utils_1.logError)('An error occurred', error);
50
+ });
42
51
  if (options.bot.token) {
43
52
  try {
44
53
  await djs.login(options.bot.token);
45
54
  if (options.bot?.token)
46
55
  exports.botData.set('botToken', options.bot.token);
56
+ const REQUIRED_INTENTS = {
57
+ 'guildCreate': v10_1.GatewayIntentBits.Guilds,
58
+ 'guildUpdate': v10_1.GatewayIntentBits.Guilds,
59
+ 'guildDelete': v10_1.GatewayIntentBits.Guilds,
60
+ 'channelCreate': v10_1.GatewayIntentBits.Guilds,
61
+ 'channelUpdate': v10_1.GatewayIntentBits.Guilds,
62
+ 'channelDelete': v10_1.GatewayIntentBits.Guilds,
63
+ 'channelPinsUpdate': v10_1.GatewayIntentBits.Guilds,
64
+ 'threadCreate': v10_1.GatewayIntentBits.Guilds,
65
+ 'threadUpdate': v10_1.GatewayIntentBits.Guilds,
66
+ 'threadDelete': v10_1.GatewayIntentBits.Guilds,
67
+ 'threadListSync': v10_1.GatewayIntentBits.Guilds,
68
+ 'threadMemberUpdate': v10_1.GatewayIntentBits.Guilds,
69
+ 'threadMembersUpdate': v10_1.GatewayIntentBits.Guilds,
70
+ 'stageInstanceCreate': v10_1.GatewayIntentBits.Guilds,
71
+ 'stageInstanceUpdate': v10_1.GatewayIntentBits.Guilds,
72
+ 'stageInstanceDelete': v10_1.GatewayIntentBits.Guilds,
73
+ 'guildMemberAdd': v10_1.GatewayIntentBits.GuildMembers,
74
+ 'guildMemberUpdate': v10_1.GatewayIntentBits.GuildMembers,
75
+ 'guildMemberRemove': v10_1.GatewayIntentBits.GuildMembers,
76
+ 'guildAuditLogEntryCreate': v10_1.GatewayIntentBits.GuildModeration,
77
+ 'guildBanAdd': v10_1.GatewayIntentBits.GuildModeration,
78
+ 'guildBanRemove': v10_1.GatewayIntentBits.GuildModeration,
79
+ 'guildEmojisUpdate': v10_1.GatewayIntentBits.GuildEmojisAndStickers,
80
+ 'guildStickersUpdate': v10_1.GatewayIntentBits.GuildEmojisAndStickers,
81
+ 'guildIntegrationsUpdate': v10_1.GatewayIntentBits.GuildIntegrations,
82
+ 'integrationCreate': v10_1.GatewayIntentBits.GuildIntegrations,
83
+ 'integrationUpdate': v10_1.GatewayIntentBits.GuildIntegrations,
84
+ 'integrationDelete': v10_1.GatewayIntentBits.GuildIntegrations,
85
+ 'webhooksUpdate': v10_1.GatewayIntentBits.GuildWebhooks,
86
+ 'inviteCreate': v10_1.GatewayIntentBits.GuildInvites,
87
+ 'inviteDelete': v10_1.GatewayIntentBits.GuildInvites,
88
+ 'voiceStateUpdate': v10_1.GatewayIntentBits.GuildVoiceStates,
89
+ 'presenceUpdate': v10_1.GatewayIntentBits.GuildPresences,
90
+ 'messageCreate': v10_1.GatewayIntentBits.GuildMessages | v10_1.GatewayIntentBits.DirectMessages,
91
+ 'messageUpdate': v10_1.GatewayIntentBits.GuildMessages | v10_1.GatewayIntentBits.DirectMessages,
92
+ 'messageDelete': v10_1.GatewayIntentBits.GuildMessages | v10_1.GatewayIntentBits.DirectMessages,
93
+ 'messageDeleteBulk': v10_1.GatewayIntentBits.GuildMessages,
94
+ 'messageReactionAdd': v10_1.GatewayIntentBits.GuildMessageReactions,
95
+ 'messageReactionRemove': v10_1.GatewayIntentBits.GuildMessageReactions,
96
+ 'messageReactionRemoveAll': v10_1.GatewayIntentBits.GuildMessageReactions,
97
+ 'messageReactionRemoveEmoji': v10_1.GatewayIntentBits.GuildMessageReactions,
98
+ 'typingStart': v10_1.GatewayIntentBits.GuildMessageTyping,
99
+ 'guildScheduledEventCreate': v10_1.GatewayIntentBits.GuildScheduledEvents,
100
+ 'guildScheduledEventUpdate': v10_1.GatewayIntentBits.GuildScheduledEvents,
101
+ 'guildScheduledEventDelete': v10_1.GatewayIntentBits.GuildScheduledEvents,
102
+ 'guildScheduledEventUserAdd': v10_1.GatewayIntentBits.GuildScheduledEvents,
103
+ 'guildScheduledEventUserRemove': v10_1.GatewayIntentBits.GuildScheduledEvents,
104
+ 'autoModerationRuleCreate': v10_1.GatewayIntentBits.AutoModerationConfiguration,
105
+ 'autoModerationRuleUpdate': v10_1.GatewayIntentBits.AutoModerationConfiguration,
106
+ 'autoModerationRuleDelete': v10_1.GatewayIntentBits.AutoModerationConfiguration,
107
+ 'autoModerationActionExecution': v10_1.GatewayIntentBits.AutoModerationExecution,
108
+ 'messagePollVoteAdd': v10_1.GatewayIntentBits.GuildMessagePolls,
109
+ 'messagePollVoteRemove': v10_1.GatewayIntentBits.GuildMessagePolls
110
+ };
111
+ const missingIntents = new Set();
112
+ const intents = Number(djs.options.intents.bitfield);
113
+ for (const eventName of Object.keys(djs._events)) {
114
+ const requiredBit = REQUIRED_INTENTS[eventName];
115
+ if (!requiredBit)
116
+ continue;
117
+ if ((intents & requiredBit) === 0) {
118
+ missingIntents.add(requiredBit);
119
+ }
120
+ }
121
+ if (missingIntents.size > 0) {
122
+ const EventNames = Object.fromEntries(Object.entries(v10_1.GatewayIntentBits).map(([key, value]) => [value, key]));
123
+ const missingIntentNames = [...missingIntents].map(bit => {
124
+ return EventNames[bit] ?? 'unknown';
125
+ });
126
+ (0, utils_1.logError)(`Missing intents: ${missingIntentNames.join(', ')}`);
127
+ }
47
128
  }
48
129
  catch (error) {
49
- console.error("⚠️ \x1b[31mInvalid token provided. Please provide a valid bot token\x1b[0m");
130
+ (0, utils_1.logError)("⚠️ \x1b[31mInvalid token provided. Please provide a valid bot token\x1b[0m", error);
50
131
  process.exit(1);
51
132
  }
52
133
  }
@@ -111,7 +192,7 @@ async function login(djs, options) {
111
192
  if (options.slash.global === false)
112
193
  exports.botData.set('globalSlash', 'false');
113
194
  }
114
- const userChosenType = options.bot.Status?.type || 3;
195
+ const userChosenType = options.bot.Status ? options.bot.Status.type : 3;
115
196
  if (options.bot.Status?.activities) {
116
197
  if (options.bot.Status.activities.length >= 1) {
117
198
  const initialActivity = options.bot.Status.activities[0];
@@ -136,7 +217,7 @@ async function login(djs, options) {
136
217
  let delay = 60000;
137
218
  if (options.bot.Status.delay !== undefined) {
138
219
  if (options.bot.Status.delay < 60000) {
139
- console.warn('⚠️ \x1b[31mDelay must be at least 1 minute.\x1b[0m');
220
+ (0, utils_1.logWarning)('⚠️ Delay must be at least 1 minute.');
140
221
  }
141
222
  delay = options.bot.Status.delay;
142
223
  }
@@ -158,7 +239,7 @@ async function login(djs, options) {
158
239
  }
159
240
  }
160
241
  catch (error) {
161
- console.error(`Error setting activity: ${error}`);
242
+ (0, utils_1.logError)("Error setting activity: ${error}", error);
162
243
  }
163
244
  }, delay);
164
245
  }
@@ -1 +1 @@
1
- {"version":3,"file":"login.js","sourceRoot":"","sources":["../../../lib/discord/events-handler/login.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,sBAsJC;AA/JD,2CAA6E;AAE7E,yDAAgD;AAChD,uDAA8C;AAC9C,uDAAiD;AAEpC,QAAA,OAAO,GAAG,IAAI,uBAA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S,EAAE,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAAC;YACtD,MAAM,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC9C,CAAC;QAEA,GAAW,CAAC,OAAO,GAAG,eAAO,CAAC;IACnC,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -7,7 +7,6 @@ import {
7
7
  MessageActionRowComponentBuilder,
8
8
  ButtonStyle,
9
9
  StringSelectMenuBuilder,
10
- StringSelectMenuInteraction
11
10
  } from "discord.js";
12
11
 
13
12
  interface PagerOptions {
@@ -55,9 +54,13 @@ import {
55
54
  attachment?: (string | Buffer)[];
56
55
  content?: string[];
57
56
  };
58
- navigationMenu?: boolean;
57
+ navigationMenu?: {
58
+ enabled?: boolean;
59
+ placeHolder?: string;
60
+ selects?: string[];
61
+ };
59
62
  }
60
-
63
+
61
64
  const CUSTOM_IDS = {
62
65
  NEXT: "next-djs-builder",
63
66
  BACK: "back-djs-builder",
@@ -86,9 +89,7 @@ import {
86
89
  private options: Required<PagerOptions>;
87
90
  private buttons: ButtonBuilder[];
88
91
  private components: ActionRowBuilder<MessageActionRowComponentBuilder>[];
89
- private selectMenus: ActionRowBuilder<StringSelectMenuBuilder>[];
90
92
  private naw_page: number = 0;
91
-
92
93
 
93
94
  constructor(message: Message, options: PagerOptions) {
94
95
  this.message = message;
@@ -103,16 +104,14 @@ import {
103
104
  label: {},
104
105
  emoji: { emojiNext: "➡", emojiBack: "⬅", emojiFirst: "⏪", emojiLast: "⏩", emojiHome: "🏠", emojiDelete: "🗑" },
105
106
  pages: { embeds: [], attachment: [], content: [] },
106
- navigationMenu: false,
107
+ navigationMenu: { enabled: false, placeHolder: "Choose a page", selects: [] },
107
108
  ...options,
108
109
  };
109
110
 
110
111
  this.validateOptions();
111
112
  this.buttons = this.createButtons();
112
113
  this.components = this.createComponents();
113
- this.selectMenus = this.createSelectMenus();
114
- }
115
-
114
+ }
116
115
  private validateOptions() {
117
116
  const { emoji } = this.options;
118
117
  if (!Object.values(emoji).every(isValidEmoji)) {
@@ -187,35 +186,40 @@ import {
187
186
 
188
187
  private createComponents(): ActionRowBuilder<MessageActionRowComponentBuilder>[] {
189
188
  const buttonRow = new ActionRowBuilder<MessageActionRowComponentBuilder>().addComponents(this.buttons);
190
-
189
+
191
190
  const otherRows = this.options.otherComponents || [];
192
- const selectMenus = this.options.navigationMenu ? this.createSelectMenus() : [];
193
-
191
+ const selectMenus = this.options.navigationMenu?.enabled ? this.createSelectMenus() : [];
192
+
194
193
  return [buttonRow, ...selectMenus, ...otherRows];
195
194
  }
196
-
195
+
197
196
  private createSelectMenus(): ActionRowBuilder<StringSelectMenuBuilder>[] {
198
197
  const { embeds = [], content = [], attachment = [] } = this.options.pages || {};
199
198
  const longest_length = Math.max(embeds.length, content.length, attachment.length);
200
-
201
199
  const selectMenus: ActionRowBuilder<StringSelectMenuBuilder>[] = [];
202
- for (let i = 0; i < longest_length; i += 25) {
203
- const menuOptions = Array.from({ length: Math.min(25, longest_length - i) }, (_, j) => ({
204
- label: `Page ${i + j + 1}`,
205
- value: `${i + j}`
206
- }));
207
-
208
- const selectMenu = new StringSelectMenuBuilder()
209
- .setCustomId(`select_${i}`)
210
- .setPlaceholder("Choose a page")
211
- .addOptions(menuOptions);
212
-
213
- selectMenus.push(new ActionRowBuilder<StringSelectMenuBuilder>().addComponents(selectMenu));
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
+ }
214
218
  }
215
-
219
+
216
220
  return selectMenus;
217
221
  }
218
-
222
+
219
223
  public async send() {
220
224
  const { embeds = [], content = [], attachment = [] } = this.options.pages || {};
221
225
 
@@ -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);
@@ -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.20",
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;IACd,KAAK,EAAE,WAAW,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB;AAED,UAAU,YAAY;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,YAAY,EAAE,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,YAAY,CAAC;CACzD;AAED,UAAU,cAAc;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CAC1B;AAED,UAAU,iBAAiB;IACvB,YAAY,EAAE,YAAY,CAAC;IAC3B,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,cAAc,CAAC,EAAE;QACb,KAAK,CAAC,EAAE,cAAc,CAAC;QACvB,QAAQ,CAAC,EAAE,cAAc,CAAC;QAC1B,IAAI,CAAC,EAAE,cAAc,CAAC;QACtB,IAAI,CAAC,EAAE,cAAc,CAAC;QACtB,IAAI,CAAC,EAAE,cAAc,CAAC;KACzB,CAAC;IACF,oBAAoB,CAAC,EAAE,gBAAgB,CAAC,GAAG,CAAC,EAAE,CAAC;IAC/C,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