@stelliajs/framework 1.5.9 → 1.6.1
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.
- package/dist/client/StelliaClient.js +1 -5
- package/dist/client/StelliaUtils.js +1 -5
- package/dist/managers/AutoCompleteManager.d.ts +5 -4
- package/dist/managers/AutoCompleteManager.js +2 -4
- package/dist/managers/BaseManager.d.ts +4 -4
- package/dist/managers/ButtonManager.d.ts +4 -4
- package/dist/managers/ButtonManager.js +2 -4
- package/dist/managers/CommandManager.d.ts +5 -4
- package/dist/managers/CommandManager.js +2 -4
- package/dist/managers/ContextMenuManager.d.ts +5 -4
- package/dist/managers/ContextMenuManager.js +2 -4
- package/dist/managers/EventManager.d.ts +5 -4
- package/dist/managers/EventManager.js +6 -16
- package/dist/managers/ModalManager.d.ts +5 -4
- package/dist/managers/ModalManager.js +2 -4
- package/dist/managers/SelectMenuManager.d.ts +5 -4
- package/dist/managers/SelectMenuManager.js +2 -4
- package/dist/utils/dateFormatters.d.ts +5 -3
- package/dist/utils/dateFormatters.js +15 -9
- package/dist/utils/files.js +8 -7
- package/dist/utils/translation.d.ts +2 -4
- package/package.json +9 -8
|
@@ -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();
|
|
@@ -67,8 +65,7 @@ export class StelliaUtils {
|
|
|
67
65
|
async initializeGuildsConfiguration() {
|
|
68
66
|
if (this.client.environment?.areGuildsConfigurationEnabled) {
|
|
69
67
|
try {
|
|
70
|
-
|
|
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) {
|
|
@@ -76,7 +73,6 @@ export class StelliaUtils {
|
|
|
76
73
|
}
|
|
77
74
|
}
|
|
78
75
|
}
|
|
79
|
-
;
|
|
80
76
|
handleAutoCompleteInteraction = async (interaction) => {
|
|
81
77
|
try {
|
|
82
78
|
const autoCompleteInteraction = 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
|
|
11
|
-
getByRegex
|
|
12
|
-
getAll
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
17
|
-
abstract getByRegex
|
|
18
|
-
abstract getAll
|
|
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
|
|
12
|
-
getByRegex
|
|
13
|
-
getAll
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
11
|
-
getByRegex
|
|
12
|
-
getAll
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
11
|
-
getByRegex
|
|
12
|
-
getAll
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
12
|
-
getByRegex
|
|
13
|
-
getAll
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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 &&
|
|
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,12 +88,10 @@ 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
|
-
|
|
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) {
|
|
@@ -108,5 +99,4 @@ export class EventManager extends BaseManager {
|
|
|
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
|
|
11
|
-
getByRegex
|
|
12
|
-
getAll
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
11
|
-
getByRegex
|
|
12
|
-
getAll
|
|
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
|
-
|
|
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
|
-
|
|
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
|
};
|
package/dist/utils/files.js
CHANGED
|
@@ -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
|
|
16
|
-
const
|
|
17
|
-
return
|
|
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
|
-
|
|
23
|
-
|
|
23
|
+
const fullPath = path.join(dirPath, file);
|
|
24
|
+
if (statSync(fullPath).isDirectory()) {
|
|
25
|
+
arrayOfFiles = getAllFilesPath(fullPath, arrayOfFiles);
|
|
24
26
|
}
|
|
25
27
|
else {
|
|
26
|
-
|
|
27
|
-
arrayOfFiles.push(path.join(__dirname, dirPath, "/", file));
|
|
28
|
+
arrayOfFiles.push(path.resolve(fullPath));
|
|
28
29
|
}
|
|
29
30
|
}
|
|
30
31
|
return arrayOfFiles;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { type Locale } from "discord.js";
|
|
2
|
-
|
|
3
|
-
|
|
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.
|
|
3
|
+
"version": "1.6.1",
|
|
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/
|
|
13
|
+
"url": "https://github.com/StelliaJS/framework.git"
|
|
14
14
|
},
|
|
15
15
|
"author": "Tweenty_",
|
|
16
16
|
"license": "ISC",
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
"framework"
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"discord.js": "^14.
|
|
27
|
-
"i18next": "^
|
|
26
|
+
"discord.js": "^14.26.2",
|
|
27
|
+
"i18next": "^26.0.3",
|
|
28
28
|
"log-symbols": "^7.0.1"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
@@ -32,10 +32,11 @@
|
|
|
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.
|
|
35
|
+
"prettier": "^3.8.1",
|
|
36
36
|
"tsc-alias": "^1.8.16",
|
|
37
|
-
"typescript
|
|
37
|
+
"typescript": "^6.0.2",
|
|
38
|
+
"typescript-eslint": "^8.58.0"
|
|
38
39
|
},
|
|
39
40
|
"type": "module",
|
|
40
|
-
"packageManager": "pnpm@10.
|
|
41
|
+
"packageManager": "pnpm@10.33.0"
|
|
41
42
|
}
|