@stelliajs/framework 1.5.8 → 1.6.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.
@@ -15,10 +15,10 @@ export class StelliaClient extends Client {
15
15
  this.environment = stelliaOptions.environment;
16
16
  }
17
17
  process.on("unhandledRejection", (error) => {
18
- logger.error(`Unhandled promise rejection: ${error.stack}`);
18
+ logger.errorWithInformation("Unhandled promise rejection", error);
19
19
  });
20
20
  process.on("uncaughtException", (error) => {
21
- logger.error(`Uncaught exception: ${error.stack}`);
21
+ logger.errorWithInformation("Uncaught exception", error);
22
22
  });
23
23
  }
24
24
  static async create(clientOptions, stelliaOptions) {
@@ -77,7 +77,6 @@ export class StelliaClient extends Client {
77
77
  this.utils = await StelliaUtils.create(this);
78
78
  await this.initializeManagers(stelliaOptions?.managers);
79
79
  }
80
- ;
81
80
  async initializeManagers(managers) {
82
81
  if (!managers) {
83
82
  return;
@@ -104,12 +103,9 @@ export class StelliaClient extends Client {
104
103
  this.managers.modals = await ModalManager.create(this, managers.modals.directoryPath);
105
104
  }
106
105
  }
107
- ;
108
106
  areManagersLoaded = () => {
109
107
  const managers = Object.values(this.managers);
110
- return managers.length === 0
111
- ? true
112
- : managers.every((manager) => manager.isManagerLoaded());
108
+ return managers.length === 0 ? true : managers.every((manager) => manager.isManagerLoaded());
113
109
  };
114
110
  static convertFilePathToProduction = (filePath) => {
115
111
  return filePath.replace("src", "dist").replace(".ts", ".js");
@@ -17,13 +17,11 @@ export class StelliaUtils {
17
17
  [InteractionType.SelectMenu, this.handleSelectMenuInteraction]
18
18
  ]);
19
19
  }
20
- ;
21
20
  static async create(client) {
22
21
  const utils = new StelliaUtils(client);
23
22
  await utils.initializeGuildsConfiguration();
24
23
  return utils;
25
24
  }
26
- ;
27
25
  initializeCommands = async () => {
28
26
  const commands = this.client.managers.commands?.getAll().values();
29
27
  const contextMenus = this.client.managers.contextMenus?.getAll().values();
@@ -37,7 +35,7 @@ export class StelliaUtils {
37
35
  logger.success("Application commands registered successfully");
38
36
  }
39
37
  catch (error) {
40
- logger.error(`Error while registering application commands: ${error.stack}`);
38
+ logger.errorWithInformation("Error while registering application commands", error);
41
39
  }
42
40
  }
43
41
  };
@@ -67,16 +65,14 @@ export class StelliaUtils {
67
65
  async initializeGuildsConfiguration() {
68
66
  if (this.client.environment?.areGuildsConfigurationEnabled) {
69
67
  try {
70
- const guildsConfiguration = await this.client.getGuildsConfiguration();
71
- this.guildsConfiguration = guildsConfiguration;
68
+ this.guildsConfiguration = await this.client.getGuildsConfiguration();
72
69
  logger.success("Guilds configuration loaded successfully for interactions");
73
70
  }
74
71
  catch (error) {
75
- logger.error(`Error while loading guilds configuration: ${error.stack}`);
72
+ logger.errorWithInformation("Error while loading guilds configuration", error);
76
73
  }
77
74
  }
78
75
  }
79
- ;
80
76
  handleAutoCompleteInteraction = async (interaction) => {
81
77
  try {
82
78
  const autoCompleteInteraction = interaction;
@@ -97,7 +93,7 @@ export class StelliaUtils {
97
93
  }
98
94
  }
99
95
  catch (error) {
100
- logger.error(`Error while handling autocomplete interaction: ${error.stack}`);
96
+ logger.errorWithInformation("Error while handling autocomplete interaction", error);
101
97
  }
102
98
  };
103
99
  handleButtonInteraction = async (interaction) => {
@@ -124,7 +120,7 @@ export class StelliaUtils {
124
120
  }
125
121
  }
126
122
  catch (error) {
127
- logger.error(`Error while handling button interaction: ${error.stack}`);
123
+ logger.errorWithInformation("Error while handling button interaction", error);
128
124
  }
129
125
  };
130
126
  handleCommandInteraction = async (interaction) => {
@@ -150,7 +146,7 @@ export class StelliaUtils {
150
146
  }
151
147
  }
152
148
  catch (error) {
153
- logger.error(`Error while handling command interaction: ${error.stack}`);
149
+ logger.errorWithInformation("Error while handling command interaction", error);
154
150
  }
155
151
  };
156
152
  handleContextMenuInteraction = async (interaction) => {
@@ -166,7 +162,7 @@ export class StelliaUtils {
166
162
  }
167
163
  }
168
164
  catch (error) {
169
- logger.error(`Error while handling context menu interaction: ${error.stack}`);
165
+ logger.errorWithInformation("Error while handling context menu interaction", error);
170
166
  }
171
167
  };
172
168
  handleModalInteraction = async (interaction) => {
@@ -193,7 +189,7 @@ export class StelliaUtils {
193
189
  }
194
190
  }
195
191
  catch (error) {
196
- logger.error(`Error while handling modal interaction: ${error.stack}`);
192
+ logger.errorWithInformation("Error while handling modal interaction", error);
197
193
  }
198
194
  };
199
195
  handleSelectMenuInteraction = async (interaction) => {
@@ -220,7 +216,7 @@ export class StelliaUtils {
220
216
  }
221
217
  }
222
218
  catch (error) {
223
- logger.error(`Error while handling select menu interaction: ${error.stack}`);
219
+ logger.errorWithInformation("Error while handling select menu interaction", error);
224
220
  }
225
221
  };
226
222
  handleMessageContextMenuInteraction = async (interaction) => {
@@ -245,7 +241,7 @@ export class StelliaUtils {
245
241
  }
246
242
  }
247
243
  catch (error) {
248
- logger.error(`Error while handling message context menu interaction: ${error.stack}`);
244
+ logger.errorWithInformation("Error while handling message context menu interaction", error);
249
245
  }
250
246
  };
251
247
  handleUserContextMenuInteraction = async (interaction) => {
@@ -270,7 +266,7 @@ export class StelliaUtils {
270
266
  }
271
267
  }
272
268
  catch (error) {
273
- logger.error(`Error while handling user context menu interaction: ${error.stack}`);
269
+ logger.errorWithInformation("Error while handling user context menu interaction", error);
274
270
  }
275
271
  };
276
272
  getInteractionType(interaction) {
@@ -1,13 +1,14 @@
1
1
  import { Collection } from "discord.js";
2
2
  import { type StelliaClient } from "../client/index.js";
3
3
  import { BaseManager } from "./index.js";
4
+ import { type AutoCompleteStructure } from "../structures/index.js";
4
5
  import { type InteractionCustomId, type StructureCustomId } from "../typescript/index.js";
5
- export declare class AutoCompleteManager extends BaseManager {
6
+ export declare class AutoCompleteManager extends BaseManager<AutoCompleteStructure> {
6
7
  private interactions;
7
8
  private constructor();
8
9
  static create(client: StelliaClient, directory: string): Promise<AutoCompleteManager>;
9
10
  loadData(): Promise<void>;
10
- getByCustomId<AutoCompleteStructure>(id: InteractionCustomId): AutoCompleteStructure | null;
11
- getByRegex<AutoCompleteStructure>(id: InteractionCustomId): AutoCompleteStructure | null;
12
- getAll<AutoCompleteStructure>(): Collection<StructureCustomId, AutoCompleteStructure>;
11
+ getByCustomId(id: InteractionCustomId): AutoCompleteStructure | null;
12
+ getByRegex(id: InteractionCustomId): AutoCompleteStructure | null;
13
+ getAll(): Collection<StructureCustomId, AutoCompleteStructure>;
13
14
  }
@@ -17,8 +17,7 @@ export class AutoCompleteManager extends BaseManager {
17
17
  this.setManagerLoaded();
18
18
  }
19
19
  getByCustomId(id) {
20
- const autoComplete = this.interactions.get(id) ?? null;
21
- return autoComplete;
20
+ return this.interactions.get(id) ?? null;
22
21
  }
23
22
  getByRegex(id) {
24
23
  let autoComplete = null;
@@ -31,7 +30,6 @@ export class AutoCompleteManager extends BaseManager {
31
30
  return autoComplete;
32
31
  }
33
32
  getAll() {
34
- const autoCompletes = this.interactions;
35
- return autoCompletes;
33
+ return this.interactions;
36
34
  }
37
35
  }
@@ -5,7 +5,7 @@ import { type InteractionCustomId, type StructureCustomId } from "../typescript/
5
5
  export interface ManagerOptions {
6
6
  directoryPath: string;
7
7
  }
8
- export declare abstract class BaseManager {
8
+ export declare abstract class BaseManager<TStructure extends AnyInteractionStructure> {
9
9
  readonly client: StelliaClient;
10
10
  readonly directoryPath: string;
11
11
  private isLoaded;
@@ -13,7 +13,7 @@ export declare abstract class BaseManager {
13
13
  isManagerLoaded(): boolean;
14
14
  setManagerLoaded(): void;
15
15
  abstract loadData(): Promise<void>;
16
- abstract getByCustomId<InteractionStructure extends AnyInteractionStructure>(id: InteractionCustomId): InteractionStructure | null;
17
- abstract getByRegex<InteractionStructure extends AnyInteractionStructure>(id: InteractionCustomId): InteractionStructure | null;
18
- abstract getAll<InteractionStructure extends AnyInteractionStructure>(): Collection<StructureCustomId, InteractionStructure>;
16
+ abstract getByCustomId(id: InteractionCustomId): TStructure | null;
17
+ abstract getByRegex(id: InteractionCustomId): TStructure | null;
18
+ abstract getAll(): Collection<StructureCustomId, TStructure>;
19
19
  }
@@ -3,12 +3,12 @@ import { type StelliaClient } from "../client/index.js";
3
3
  import { BaseManager } from "./index.js";
4
4
  import { type ButtonStructure } from "../structures/index.js";
5
5
  import { type InteractionCustomId, type StructureCustomId } from "../typescript/index.js";
6
- export declare class ButtonManager extends BaseManager {
6
+ export declare class ButtonManager extends BaseManager<ButtonStructure> {
7
7
  interactions: Collection<StructureCustomId, ButtonStructure>;
8
8
  private constructor();
9
9
  static create(client: StelliaClient, directory: string): Promise<ButtonManager>;
10
10
  loadData(): Promise<void>;
11
- getByCustomId<ButtonStructure>(id: InteractionCustomId): ButtonStructure | null;
12
- getByRegex<ButtonStructure>(id: InteractionCustomId): ButtonStructure | null;
13
- getAll<ButtonStructure>(): Collection<StructureCustomId, ButtonStructure>;
11
+ getByCustomId(id: InteractionCustomId): ButtonStructure | null;
12
+ getByRegex(id: InteractionCustomId): ButtonStructure | null;
13
+ getAll(): Collection<StructureCustomId, ButtonStructure>;
14
14
  }
@@ -17,8 +17,7 @@ export class ButtonManager extends BaseManager {
17
17
  this.setManagerLoaded();
18
18
  }
19
19
  getByCustomId(id) {
20
- const button = this.interactions.get(id) ?? null;
21
- return button;
20
+ return this.interactions.get(id) ?? null;
22
21
  }
23
22
  getByRegex(id) {
24
23
  let button = null;
@@ -31,7 +30,6 @@ export class ButtonManager extends BaseManager {
31
30
  return button;
32
31
  }
33
32
  getAll() {
34
- const buttons = this.interactions;
35
- return buttons;
33
+ return this.interactions;
36
34
  }
37
35
  }
@@ -1,13 +1,14 @@
1
1
  import { Collection } from "discord.js";
2
2
  import { type StelliaClient } from "../client/index.js";
3
3
  import { BaseManager } from "./index.js";
4
+ import { type CommandStructure } from "../structures/index.js";
4
5
  import { type InteractionCustomId, type StructureCustomId } from "../typescript/index.js";
5
- export declare class CommandManager extends BaseManager {
6
+ export declare class CommandManager extends BaseManager<CommandStructure> {
6
7
  private interactions;
7
8
  private constructor();
8
9
  static create(client: StelliaClient, directory: string): Promise<CommandManager>;
9
10
  loadData(): Promise<void>;
10
- getByCustomId<CommandStructure>(id: InteractionCustomId): CommandStructure | null;
11
- getByRegex<CommandStructure>(id: InteractionCustomId): CommandStructure | null;
12
- getAll<CommandStructure>(): Collection<StructureCustomId, CommandStructure>;
11
+ getByCustomId(id: InteractionCustomId): CommandStructure | null;
12
+ getByRegex(id: InteractionCustomId): CommandStructure | null;
13
+ getAll(): Collection<StructureCustomId, CommandStructure>;
13
14
  }
@@ -17,8 +17,7 @@ export class CommandManager extends BaseManager {
17
17
  this.setManagerLoaded();
18
18
  }
19
19
  getByCustomId(id) {
20
- const command = this.interactions.get(id) ?? null;
21
- return command;
20
+ return this.interactions.get(id) ?? null;
22
21
  }
23
22
  getByRegex(id) {
24
23
  let command = null;
@@ -31,7 +30,6 @@ export class CommandManager extends BaseManager {
31
30
  return command;
32
31
  }
33
32
  getAll() {
34
- const commands = this.interactions;
35
- return commands;
33
+ return this.interactions;
36
34
  }
37
35
  }
@@ -1,13 +1,14 @@
1
1
  import { Collection } from "discord.js";
2
2
  import { type StelliaClient } from "../client/index.js";
3
3
  import { BaseManager } from "./index.js";
4
+ import { type ContextMenuStructure } from "../structures/index.js";
4
5
  import { type InteractionCustomId, type StructureCustomId } from "../typescript/index.js";
5
- export declare class ContextMenuManager extends BaseManager {
6
+ export declare class ContextMenuManager extends BaseManager<ContextMenuStructure> {
6
7
  private interactions;
7
8
  private constructor();
8
9
  static create(client: StelliaClient, directory: string): Promise<ContextMenuManager>;
9
10
  loadData(): Promise<void>;
10
- getByCustomId<ContextMenuStructure>(id: InteractionCustomId): ContextMenuStructure | null;
11
- getByRegex<ContextMenuStructure>(id: InteractionCustomId): ContextMenuStructure | null;
12
- getAll<ContextMenuStructure>(): Collection<StructureCustomId, ContextMenuStructure>;
11
+ getByCustomId(id: InteractionCustomId): ContextMenuStructure | null;
12
+ getByRegex(id: InteractionCustomId): ContextMenuStructure | null;
13
+ getAll(): Collection<StructureCustomId, ContextMenuStructure>;
13
14
  }
@@ -17,8 +17,7 @@ export class ContextMenuManager extends BaseManager {
17
17
  this.setManagerLoaded();
18
18
  }
19
19
  getByCustomId(id) {
20
- const contextMenu = this.interactions.get(id) ?? null;
21
- return contextMenu;
20
+ return this.interactions.get(id) ?? null;
22
21
  }
23
22
  getByRegex(id) {
24
23
  let contextMenu = null;
@@ -31,7 +30,6 @@ export class ContextMenuManager extends BaseManager {
31
30
  return contextMenu;
32
31
  }
33
32
  getAll() {
34
- const contextMenus = this.interactions;
35
- return contextMenus;
33
+ return this.interactions;
36
34
  }
37
35
  }
@@ -1,16 +1,17 @@
1
1
  import { Collection } from "discord.js";
2
2
  import { type StelliaClient } from "../client/index.js";
3
3
  import { BaseManager } from "./index.js";
4
+ import { type EventStructure } from "../structures/index.js";
4
5
  import { type InteractionCustomId, type StructureCustomId } from "../typescript/index.js";
5
- export declare class EventManager extends BaseManager {
6
+ export declare class EventManager extends BaseManager<EventStructure> {
6
7
  private interactions;
7
8
  private guildsConfiguration;
8
9
  private constructor();
9
10
  static create(client: StelliaClient, directoryPath: string): Promise<EventManager>;
10
11
  loadData(): Promise<void>;
11
- getByCustomId<EventStructure>(id: InteractionCustomId): EventStructure | null;
12
- getByRegex<EventStructure>(id: InteractionCustomId): EventStructure | null;
13
- getAll<EventStructure>(): Collection<StructureCustomId, EventStructure>;
12
+ getByCustomId(id: InteractionCustomId): EventStructure | null;
13
+ getByRegex(id: InteractionCustomId): EventStructure | null;
14
+ getAll(): Collection<StructureCustomId, EventStructure>;
14
15
  private loadEventWithGuildConfiguration;
15
16
  private readonly eventHandler;
16
17
  private loadEventWithoutGuildConfiguration;
@@ -14,10 +14,8 @@ export class EventManager extends BaseManager {
14
14
  await manager.initializeGuildsConfiguration();
15
15
  return manager;
16
16
  }
17
- ;
18
17
  async loadData() {
19
- const events = await requiredFiles(this.directoryPath);
20
- this.interactions = events;
18
+ this.interactions = await requiredFiles(this.directoryPath);
21
19
  for (const eventStructure of this.interactions.values()) {
22
20
  if (this.client.environment?.areGuildsConfigurationEnabled) {
23
21
  await this.loadEventWithGuildConfiguration(eventStructure);
@@ -29,8 +27,7 @@ export class EventManager extends BaseManager {
29
27
  this.setManagerLoaded();
30
28
  }
31
29
  getByCustomId(id) {
32
- const event = this.interactions.get(id) ?? null;
33
- return event;
30
+ return this.interactions.get(id) ?? null;
34
31
  }
35
32
  getByRegex(id) {
36
33
  let event = null;
@@ -43,8 +40,7 @@ export class EventManager extends BaseManager {
43
40
  return event;
44
41
  }
45
42
  getAll() {
46
- const events = this.interactions;
47
- return events;
43
+ return this.interactions;
48
44
  }
49
45
  async loadEventWithGuildConfiguration(eventStructure) {
50
46
  const { name, once } = eventStructure.data;
@@ -56,7 +52,6 @@ export class EventManager extends BaseManager {
56
52
  this.client.on(name, (...args) => this.eventHandler(event, ...args));
57
53
  }
58
54
  }
59
- ;
60
55
  eventHandler = (event, ...args) => {
61
56
  const mainArgument = args[0];
62
57
  const guildConfiguration = this.getGuildConfiguration(mainArgument);
@@ -65,7 +60,7 @@ export class EventManager extends BaseManager {
65
60
  return eventStructure.execute(this.client, guildConfiguration, ...args);
66
61
  }
67
62
  const eventStructure = event;
68
- return eventStructure.execute(this.client, this.guildsConfiguration);
63
+ return eventStructure.execute(this.client, this.guildsConfiguration, ...args);
69
64
  };
70
65
  async loadEventWithoutGuildConfiguration(eventStructure) {
71
66
  const { name, once } = eventStructure.data;
@@ -77,7 +72,6 @@ export class EventManager extends BaseManager {
77
72
  this.client.on(name, (...args) => event.execute(this.client, ...args));
78
73
  }
79
74
  }
80
- ;
81
75
  getGuildConfiguration(mainArgument) {
82
76
  if (mainArgument && typeof mainArgument === "object") {
83
77
  if ("guildId" in mainArgument && mainArgument.guildId) {
@@ -86,8 +80,7 @@ export class EventManager extends BaseManager {
86
80
  if ("guild" in mainArgument && mainArgument.guild) {
87
81
  return this.client.getGuildConfiguration(mainArgument.guild.id);
88
82
  }
89
- if (mainArgument && typeof mainArgument === "object" &&
90
- "message" in mainArgument && mainArgument.message &&
83
+ if ("message" in mainArgument && mainArgument.message &&
91
84
  typeof mainArgument.message === "object" && "guild" in mainArgument.message &&
92
85
  mainArgument.message.guild && "id" in mainArgument.message.guild) {
93
86
  return this.client.getGuildConfiguration(mainArgument.message.guild.id);
@@ -95,18 +88,15 @@ export class EventManager extends BaseManager {
95
88
  }
96
89
  return undefined;
97
90
  }
98
- ;
99
91
  async initializeGuildsConfiguration() {
100
92
  if (this.client.environment?.areGuildsConfigurationEnabled) {
101
93
  try {
102
- const guildsConfiguration = await this.client.getGuildsConfiguration();
103
- this.guildsConfiguration = guildsConfiguration;
94
+ this.guildsConfiguration = await this.client.getGuildsConfiguration();
104
95
  logger.success("Guilds configuration loaded successfully for events");
105
96
  }
106
97
  catch (error) {
107
- logger.error(`Error while loading guilds configuration: ${error.stack}`);
98
+ logger.errorWithInformation("Error while loading guilds configuration", error);
108
99
  }
109
100
  }
110
101
  }
111
- ;
112
102
  }
@@ -1,13 +1,14 @@
1
1
  import { Collection } from "discord.js";
2
2
  import { type StelliaClient } from "../client/index.js";
3
3
  import { BaseManager } from "./index.js";
4
+ import { type ModalStructure } from "../structures/index.js";
4
5
  import { type InteractionCustomId, type StructureCustomId } from "../typescript/index.js";
5
- export declare class ModalManager extends BaseManager {
6
+ export declare class ModalManager extends BaseManager<ModalStructure> {
6
7
  private interactions;
7
8
  private constructor();
8
9
  static create(client: StelliaClient, directory: string): Promise<ModalManager>;
9
10
  loadData(): Promise<void>;
10
- getByCustomId<ModalStructure>(id: InteractionCustomId): ModalStructure | null;
11
- getByRegex<ModalStructure>(id: InteractionCustomId): ModalStructure | null;
12
- getAll<ModalStructure>(): Collection<StructureCustomId, ModalStructure>;
11
+ getByCustomId(id: InteractionCustomId): ModalStructure | null;
12
+ getByRegex(id: InteractionCustomId): ModalStructure | null;
13
+ getAll(): Collection<StructureCustomId, ModalStructure>;
13
14
  }
@@ -17,8 +17,7 @@ export class ModalManager extends BaseManager {
17
17
  this.setManagerLoaded();
18
18
  }
19
19
  getByCustomId(id) {
20
- const modal = this.interactions.get(id) ?? null;
21
- return modal;
20
+ return this.interactions.get(id) ?? null;
22
21
  }
23
22
  getByRegex(id) {
24
23
  let modal = null;
@@ -31,7 +30,6 @@ export class ModalManager extends BaseManager {
31
30
  return modal;
32
31
  }
33
32
  getAll() {
34
- const modals = this.interactions;
35
- return modals;
33
+ return this.interactions;
36
34
  }
37
35
  }
@@ -1,13 +1,14 @@
1
1
  import { Collection } from "discord.js";
2
2
  import { type StelliaClient } from "../client/index.js";
3
3
  import { BaseManager } from "./index.js";
4
+ import { type SelectMenuStructure } from "../structures/index.js";
4
5
  import { type InteractionCustomId, type StructureCustomId } from "../typescript/index.js";
5
- export declare class SelectMenuManager extends BaseManager {
6
+ export declare class SelectMenuManager extends BaseManager<SelectMenuStructure> {
6
7
  private interactions;
7
8
  private constructor();
8
9
  static create(client: StelliaClient, directory: string): Promise<SelectMenuManager>;
9
10
  loadData(): Promise<void>;
10
- getByCustomId<SelectMenuStructure>(id: InteractionCustomId): SelectMenuStructure | null;
11
- getByRegex<SelectMenuStructure>(id: InteractionCustomId): SelectMenuStructure | null;
12
- getAll<SelectMenuStructure>(): Collection<StructureCustomId, SelectMenuStructure>;
11
+ getByCustomId(id: InteractionCustomId): SelectMenuStructure | null;
12
+ getByRegex(id: InteractionCustomId): SelectMenuStructure | null;
13
+ getAll(): Collection<StructureCustomId, SelectMenuStructure>;
13
14
  }
@@ -17,8 +17,7 @@ export class SelectMenuManager extends BaseManager {
17
17
  this.setManagerLoaded();
18
18
  }
19
19
  getByCustomId(id) {
20
- const selectMenu = this.interactions.get(id) ?? null;
21
- return selectMenu;
20
+ return this.interactions.get(id) ?? null;
22
21
  }
23
22
  getByRegex(id) {
24
23
  let selectMenu = null;
@@ -31,7 +30,6 @@ export class SelectMenuManager extends BaseManager {
31
30
  return selectMenu;
32
31
  }
33
32
  getAll() {
34
- const selectMenus = this.interactions;
35
- return selectMenus;
33
+ return this.interactions;
36
34
  }
37
35
  }
@@ -1,7 +1,9 @@
1
- export declare const formatTimestampToShortDateTime: (timestamp: number) => string;
2
1
  export declare const formatTimestampToShortTime: (timestamp: number) => string;
2
+ export declare const formatTimestampToMediumTime: (timestamp: number) => string;
3
3
  export declare const formatTimestampToShortDate: (timestamp: number) => string;
4
- export declare const formatTimestampToLongDateTime: (timestamp: number) => string;
5
- export declare const formatTimestampToLongTime: (timestamp: number) => string;
6
4
  export declare const formatTimestampToLongDate: (timestamp: number) => string;
5
+ export declare const formatTimestampToLongDateShortTime: (timestamp: number) => string;
6
+ export declare const formatTimestampToFullDateShortTime: (timestamp: number) => string;
7
+ export declare const formatTimestampToShortDateShortTime: (timestamp: number) => string;
8
+ export declare const formatTimestampToShortDateMediumTime: (timestamp: number) => string;
7
9
  export declare const formatTimestampToRelativeTime: (timestamp: number) => string;
@@ -1,22 +1,28 @@
1
1
  import { time, TimestampStyles } from "discord.js";
2
- export const formatTimestampToShortDateTime = (timestamp) => {
3
- return time(Math.round(timestamp / 1000), TimestampStyles.ShortDateTime);
4
- };
5
2
  export const formatTimestampToShortTime = (timestamp) => {
6
3
  return time(Math.round(timestamp / 1000), TimestampStyles.ShortTime);
7
4
  };
5
+ export const formatTimestampToMediumTime = (timestamp) => {
6
+ return time(Math.round(timestamp / 1000), TimestampStyles.MediumTime);
7
+ };
8
8
  export const formatTimestampToShortDate = (timestamp) => {
9
9
  return time(Math.round(timestamp / 1000), TimestampStyles.ShortDate);
10
10
  };
11
- export const formatTimestampToLongDateTime = (timestamp) => {
12
- return time(Math.round(timestamp / 1000), TimestampStyles.LongDateTime);
13
- };
14
- export const formatTimestampToLongTime = (timestamp) => {
15
- return time(Math.round(timestamp / 1000), TimestampStyles.LongTime);
16
- };
17
11
  export const formatTimestampToLongDate = (timestamp) => {
18
12
  return time(Math.round(timestamp / 1000), TimestampStyles.LongDate);
19
13
  };
14
+ export const formatTimestampToLongDateShortTime = (timestamp) => {
15
+ return time(Math.round(timestamp / 1000), TimestampStyles.LongDateShortTime);
16
+ };
17
+ export const formatTimestampToFullDateShortTime = (timestamp) => {
18
+ return time(Math.round(timestamp / 1000), TimestampStyles.FullDateShortTime);
19
+ };
20
+ export const formatTimestampToShortDateShortTime = (timestamp) => {
21
+ return time(Math.round(timestamp / 1000), TimestampStyles.ShortDateShortTime);
22
+ };
23
+ export const formatTimestampToShortDateMediumTime = (timestamp) => {
24
+ return time(Math.round(timestamp / 1000), TimestampStyles.ShortDateMediumTime);
25
+ };
20
26
  export const formatTimestampToRelativeTime = (timestamp) => {
21
27
  return time(Math.round(timestamp / 1000), TimestampStyles.RelativeTime);
22
28
  };
@@ -1,5 +1,6 @@
1
1
  import { readdirSync, statSync } from "node:fs";
2
2
  import path from "node:path";
3
+ import { pathToFileURL } from "node:url";
3
4
  import { Collection } from "discord.js";
4
5
  export const requiredFiles = async (directoryPath) => {
5
6
  const collection = new Collection();
@@ -12,19 +13,19 @@ export const requiredFiles = async (directoryPath) => {
12
13
  return collection;
13
14
  };
14
15
  const loadInteraction = async (filePath) => {
15
- const module = await import(`file://${filePath}`);
16
- const data = module.default;
17
- return data;
16
+ const moduleUrl = pathToFileURL(filePath).href;
17
+ const module = await import(moduleUrl);
18
+ return module.default;
18
19
  };
19
20
  const getAllFilesPath = (dirPath, arrayOfFiles = []) => {
20
21
  const files = readdirSync(dirPath);
21
22
  for (const file of files) {
22
- if (statSync(dirPath + "/" + file).isDirectory()) {
23
- arrayOfFiles = getAllFilesPath(dirPath + "/" + file, arrayOfFiles);
23
+ const fullPath = path.join(dirPath, file);
24
+ if (statSync(fullPath).isDirectory()) {
25
+ arrayOfFiles = getAllFilesPath(fullPath, arrayOfFiles);
24
26
  }
25
27
  else {
26
- const __dirname = path.resolve();
27
- arrayOfFiles.push(path.join(__dirname, dirPath, "/", file));
28
+ arrayOfFiles.push(path.resolve(fullPath));
28
29
  }
29
30
  }
30
31
  return arrayOfFiles;
@@ -3,4 +3,5 @@ export declare const logger: {
3
3
  success: (message: string) => void;
4
4
  warn: (message: string) => void;
5
5
  error: (message: string) => void;
6
+ errorWithInformation: (message: string, error: Error) => void;
6
7
  };
@@ -12,5 +12,8 @@ export const logger = {
12
12
  },
13
13
  error: (message) => {
14
14
  console.error(`${logSymbols.error} ${prefix} ${message}`);
15
+ },
16
+ errorWithInformation: (message, error) => {
17
+ console.error(`${logSymbols.error} ${prefix} ${message}: `, error);
15
18
  }
16
19
  };
@@ -1,6 +1,4 @@
1
1
  import { type Locale } from "discord.js";
2
- interface TranslateArgs {
3
- [key: string]: any;
4
- }
5
- export declare const translateToLocale: (locale: Locale, key: string, args?: TranslateArgs) => Promise<any>;
2
+ type TranslateArgs = Record<string, unknown>;
3
+ export declare const translateToLocale: <T = unknown>(locale: Locale, key: string, args?: TranslateArgs) => Promise<T>;
6
4
  export {};
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@stelliajs/framework",
3
- "version": "1.5.8",
3
+ "version": "1.6.0",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "scripts": {
7
7
  "lint": "eslint src --ext .ts",
8
- "format": "prettier --write .",
8
+ "format": "prettier --write ./src/**/*.ts",
9
9
  "build": "tsc && tsc-alias"
10
10
  },
11
11
  "repository": {
12
12
  "type": "git",
13
- "url": "https://github.com/stelliajs/framework.git"
13
+ "url": "https://github.com/StelliaJS/framework.git"
14
14
  },
15
15
  "author": "Tweenty_",
16
16
  "license": "ISC",
@@ -23,19 +23,20 @@
23
23
  "framework"
24
24
  ],
25
25
  "dependencies": {
26
- "discord.js": "^14.24.0",
27
- "i18next": "^25.6.0",
26
+ "discord.js": "^14.26.2",
27
+ "i18next": "^26.0.3",
28
28
  "log-symbols": "^7.0.1"
29
29
  },
30
30
  "devDependencies": {
31
- "@eslint/js": "^9.38.0",
31
+ "@eslint/js": "^9.39.1",
32
32
  "eslint-config-prettier": "^10.1.8",
33
33
  "eslint-import-resolver-typescript": "^4.4.4",
34
34
  "eslint-plugin-import": "^2.32.0",
35
- "prettier": "^3.6.2",
35
+ "prettier": "^3.8.1",
36
36
  "tsc-alias": "^1.8.16",
37
- "typescript-eslint": "^8.46.2"
37
+ "typescript": "^6.0.2",
38
+ "typescript-eslint": "^8.58.0"
38
39
  },
39
40
  "type": "module",
40
- "packageManager": "pnpm@10.19.0"
41
+ "packageManager": "pnpm@10.33.0"
41
42
  }