@stelliajs/framework 1.3.0-dev-2 → 1.3.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.
|
@@ -11,6 +11,9 @@ export class StelliaClient extends Client {
|
|
|
11
11
|
environment;
|
|
12
12
|
constructor(clientOptions, stelliaOptions) {
|
|
13
13
|
super(clientOptions);
|
|
14
|
+
if (stelliaOptions?.environment) {
|
|
15
|
+
this.environment = stelliaOptions.environment;
|
|
16
|
+
}
|
|
14
17
|
if (stelliaOptions?.managers.autoCompletes?.directoryPath) {
|
|
15
18
|
this.managers.autoCompletes = new AutoCompleteManager(this, stelliaOptions.managers.autoCompletes.directoryPath);
|
|
16
19
|
}
|
|
@@ -32,9 +35,6 @@ export class StelliaClient extends Client {
|
|
|
32
35
|
if (stelliaOptions?.managers.modals?.directoryPath) {
|
|
33
36
|
this.managers.modals = new ModalManager(this, stelliaOptions.managers.modals.directoryPath);
|
|
34
37
|
}
|
|
35
|
-
if (stelliaOptions?.environment) {
|
|
36
|
-
this.environment = stelliaOptions.environment;
|
|
37
|
-
}
|
|
38
38
|
this.utils = new StelliaUtils(this);
|
|
39
39
|
process.on("unhandledRejection", (error) => {
|
|
40
40
|
logger.error(`Unhandled promise rejection: ${error}`);
|
|
@@ -44,9 +44,12 @@ export class StelliaUtils {
|
|
|
44
44
|
if (!this.client.environment.areGuildsConfigurationEnabled || !this.guildsConfiguration) {
|
|
45
45
|
return undefined;
|
|
46
46
|
}
|
|
47
|
-
const { guilds,
|
|
47
|
+
const { guilds, general } = this.guildsConfiguration;
|
|
48
48
|
const guildConfiguration = guilds[guildId];
|
|
49
|
-
return {
|
|
49
|
+
return {
|
|
50
|
+
general: general,
|
|
51
|
+
guild: guildConfiguration
|
|
52
|
+
};
|
|
50
53
|
};
|
|
51
54
|
handleInteraction = async (interaction) => {
|
|
52
55
|
if (interaction.inCachedGuild()) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Collection
|
|
1
|
+
import { Collection } from "discord.js";
|
|
2
2
|
import { BaseManager } from "./index.js";
|
|
3
3
|
import { requiredFiles } from "../utils/index.js";
|
|
4
4
|
import { logger } from "../utils/logger.js";
|
|
@@ -27,7 +27,6 @@ export class EventManager extends BaseManager {
|
|
|
27
27
|
await this.loadEventWithoutGuildConfiguration(eventStructure);
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
-
this.client.on(Events.Error, (error) => logger.error(`Client error: ${error}`));
|
|
31
30
|
this.setManagerLoaded();
|
|
32
31
|
}
|
|
33
32
|
getByCustomId(id) {
|
|
@@ -53,16 +52,13 @@ export class EventManager extends BaseManager {
|
|
|
53
52
|
}
|
|
54
53
|
eventHandler = (event, ...args) => {
|
|
55
54
|
const mainArgument = args[0];
|
|
56
|
-
if (!mainArgument) {
|
|
57
|
-
const eventStructure = event;
|
|
58
|
-
return eventStructure.execute(this.client, this.guildsConfiguration);
|
|
59
|
-
}
|
|
60
55
|
const guildConfiguration = this.getGuildConfiguration(mainArgument);
|
|
61
56
|
if (guildConfiguration) {
|
|
62
57
|
const eventStructure = event;
|
|
63
58
|
return eventStructure.execute(this.client, guildConfiguration, ...args);
|
|
64
59
|
}
|
|
65
|
-
|
|
60
|
+
const eventStructure = event;
|
|
61
|
+
return eventStructure.execute(this.client, this.guildsConfiguration);
|
|
66
62
|
};
|
|
67
63
|
async loadEventWithoutGuildConfiguration(eventStructure) {
|
|
68
64
|
const { name, once } = eventStructure.data;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type AutoCompleteManager, type ButtonManager, type CommandManager, type ContextMenuManager, type EventManager, type ModalManager, type SelectMenuManager } from "../managers/index.js";
|
|
2
|
+
import { type Snowflake } from "discord.js";
|
|
2
3
|
export type StructureCustomId = string | RegExp;
|
|
3
4
|
export type InteractionCustomId = string;
|
|
4
5
|
export declare enum InteractionType {
|
|
@@ -35,7 +36,7 @@ export interface GuildsConfiguration {
|
|
|
35
36
|
[key: string]: unknown;
|
|
36
37
|
};
|
|
37
38
|
guilds: {
|
|
38
|
-
[guildId
|
|
39
|
+
[guildId in Snowflake]: BaseGuildConfiguration;
|
|
39
40
|
};
|
|
40
41
|
}
|
|
41
42
|
export interface GuildConfiguration {
|
package/dist/utils/index.d.ts
CHANGED
package/dist/utils/index.js
CHANGED