@stelliajs/framework 1.4.4 → 1.4.6
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/.prettierrc +12 -0
- package/README.md +44 -38
- package/dist/client/StelliaClient.js +4 -4
- package/dist/client/StelliaUtils.d.ts +1 -1
- package/dist/client/StelliaUtils.js +21 -15
- package/dist/managers/AutoCompleteManager.d.ts +1 -1
- package/dist/managers/BaseManager.d.ts +1 -1
- package/dist/managers/ButtonManager.d.ts +1 -1
- package/dist/managers/CommandManager.d.ts +1 -1
- package/dist/managers/ContextMenuManager.d.ts +1 -1
- package/dist/managers/EventManager.d.ts +1 -1
- package/dist/managers/EventManager.js +3 -2
- package/dist/managers/ModalManager.d.ts +1 -1
- package/dist/managers/SelectMenuManager.d.ts +1 -1
- package/dist/structures/Interaction.d.ts +3 -3
- package/dist/typescript/types.d.ts +1 -1
- package/dist/utils/index.d.ts +0 -1
- package/dist/utils/index.js +0 -1
- package/package.json +41 -27
- package/dist/utils/ephemeralReponse.d.ts +0 -3
- package/dist/utils/ephemeralReponse.js +0 -39
package/.prettierrc
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"plugins": ["@trivago/prettier-plugin-sort-imports"],
|
|
3
|
+
"importOrder": ["^node:", "^[a-z]", "^@", "^[./]"],
|
|
4
|
+
"importOrderSeparation": false,
|
|
5
|
+
"importOrderSortSpecifiers": true,
|
|
6
|
+
"semi": true,
|
|
7
|
+
"singleQuote": false,
|
|
8
|
+
"useTabs": true,
|
|
9
|
+
"tabWidth": 2,
|
|
10
|
+
"trailingComma": "none",
|
|
11
|
+
"printWidth": 100
|
|
12
|
+
}
|
package/README.md
CHANGED
|
@@ -6,7 +6,9 @@ StelliaJS is built using Discord JS V14 and TypeScript. It allows you to quickly
|
|
|
6
6
|
A CLI is available to help you set up a project with StelliaJS : [link to the CLI](https://github.com/StelliaJS/cli)
|
|
7
7
|
|
|
8
8
|
## Architecture
|
|
9
|
+
|
|
9
10
|
Recommended architecture for StelliaJS project.
|
|
11
|
+
|
|
10
12
|
```
|
|
11
13
|
.
|
|
12
14
|
├── dist // Build folder
|
|
@@ -49,45 +51,48 @@ Recommended architecture for StelliaJS project.
|
|
|
49
51
|
### Simple client with environment
|
|
50
52
|
|
|
51
53
|
```js
|
|
52
|
-
import { StelliaClient } from "@stelliajs/framework";
|
|
53
54
|
import { GatewayIntentBits, Partials } from "discord.js";
|
|
55
|
+
import { StelliaClient } from "@stelliajs/framework";
|
|
54
56
|
|
|
55
|
-
const client = new StelliaClient(
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
57
|
+
const client = new StelliaClient(
|
|
58
|
+
{
|
|
59
|
+
intents: [
|
|
60
|
+
GatewayIntentBits.Guilds,
|
|
61
|
+
GatewayIntentBits.GuildMessages,
|
|
62
|
+
GatewayIntentBits.MessageContent,
|
|
63
|
+
GatewayIntentBits.GuildMembers
|
|
64
|
+
],
|
|
65
|
+
partials: [Partials.Message, Partials.GuildMember]
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
managers: {
|
|
69
|
+
autoCompletes: {
|
|
70
|
+
directoryPath: "./interactions/autoCompletes"
|
|
71
|
+
},
|
|
72
|
+
buttons: {
|
|
73
|
+
directoryPath: "./interactions/buttons"
|
|
74
|
+
},
|
|
75
|
+
commands: {
|
|
76
|
+
directoryPath: "./commands/slash"
|
|
77
|
+
},
|
|
78
|
+
contextMenus: {
|
|
79
|
+
directoryPath: "./commands/contextMenus"
|
|
80
|
+
},
|
|
81
|
+
events: {
|
|
82
|
+
directoryPath: "./events"
|
|
83
|
+
},
|
|
84
|
+
modals: {
|
|
85
|
+
directoryPath: "./interactions/modals"
|
|
86
|
+
},
|
|
87
|
+
selectMenus: {
|
|
88
|
+
directoryPath: "./interactions/selectMenus"
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
environment: {
|
|
92
|
+
areGuildsConfigurationEnabled: true
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
);
|
|
91
96
|
|
|
92
97
|
await client.connect(process.env.TOKEN);
|
|
93
98
|
```
|
|
@@ -95,6 +100,7 @@ await client.connect(process.env.TOKEN);
|
|
|
95
100
|
### Simple event
|
|
96
101
|
|
|
97
102
|
#### Ready event with environment
|
|
103
|
+
|
|
98
104
|
```js
|
|
99
105
|
import { type StelliaClient, type EventStructure } from "@stelliajs/framework";
|
|
100
106
|
import { Events } from "discord.js";
|
|
@@ -113,6 +119,7 @@ export default {
|
|
|
113
119
|
```
|
|
114
120
|
|
|
115
121
|
#### InteractionCreate event with environment
|
|
122
|
+
|
|
116
123
|
```js
|
|
117
124
|
import { type StelliaClient, type EventStructure } from "@stelliajs/framework";
|
|
118
125
|
import { Events, type Interaction } from "discord.js";
|
|
@@ -147,7 +154,6 @@ export default {
|
|
|
147
154
|
} as CommandStructure;
|
|
148
155
|
```
|
|
149
156
|
|
|
150
|
-
|
|
151
157
|
## Help
|
|
152
158
|
|
|
153
159
|
If you need help with the framework you can open an issue.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import * as fs from "node:fs";
|
|
1
2
|
import { Client } from "discord.js";
|
|
2
|
-
import { AutoCompleteManager, ButtonManager, CommandManager, ContextMenuManager, EventManager, ModalManager, SelectMenuManager } from "../managers/index.js";
|
|
3
|
-
import { StelliaUtils } from "./index.js";
|
|
4
3
|
import path from "path";
|
|
5
|
-
import * as fs from "node:fs";
|
|
6
4
|
import { pathToFileURL } from "url";
|
|
5
|
+
import { StelliaUtils } from "./index.js";
|
|
6
|
+
import { AutoCompleteManager, ButtonManager, CommandManager, ContextMenuManager, EventManager, ModalManager, SelectMenuManager } from "../managers/index.js";
|
|
7
7
|
import { logger } from "../utils/logger.js";
|
|
8
8
|
export class StelliaClient extends Client {
|
|
9
9
|
utils;
|
|
@@ -58,7 +58,7 @@ export class StelliaClient extends Client {
|
|
|
58
58
|
await this.utils.initializeCommands();
|
|
59
59
|
};
|
|
60
60
|
getGuildsConfiguration = async () => {
|
|
61
|
-
const chosenEnvironment = process.argv.find(arg => arg.startsWith("--config"))?.split("=")[1];
|
|
61
|
+
const chosenEnvironment = process.argv.find((arg) => arg.startsWith("--config"))?.split("=")[1];
|
|
62
62
|
if (!chosenEnvironment) {
|
|
63
63
|
throw new Error("Environment not provided");
|
|
64
64
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type StelliaClient } from "./index.js";
|
|
2
1
|
import { type Interaction } from "discord.js";
|
|
2
|
+
import { type StelliaClient } from "./index.js";
|
|
3
3
|
import { type GuildConfiguration } from "../typescript/index.js";
|
|
4
4
|
export declare class StelliaUtils {
|
|
5
5
|
readonly client: StelliaClient;
|
|
@@ -17,12 +17,13 @@ export class StelliaUtils {
|
|
|
17
17
|
[InteractionType.SelectMenu, this.handleSelectMenuInteraction]
|
|
18
18
|
]);
|
|
19
19
|
if (this.client.environment.areGuildsConfigurationEnabled) {
|
|
20
|
-
this.client
|
|
20
|
+
this.client
|
|
21
|
+
.getGuildsConfiguration()
|
|
21
22
|
.then((guildsConfiguration) => {
|
|
22
23
|
this.guildsConfiguration = guildsConfiguration;
|
|
23
24
|
logger.success("Guilds configuration loaded successfully for interactions");
|
|
24
25
|
})
|
|
25
|
-
.catch((error) => logger.error(`Error while loading guilds configuration: ${error}`));
|
|
26
|
+
.catch((error) => logger.error(`Error while loading guilds configuration: ${error.stack}`));
|
|
26
27
|
}
|
|
27
28
|
}
|
|
28
29
|
initializeCommands = async () => {
|
|
@@ -32,11 +33,13 @@ export class StelliaUtils {
|
|
|
32
33
|
if (this.client.isReady()) {
|
|
33
34
|
const rest = new REST({ version: DISCORD_API_VERSION }).setToken(this.client.token);
|
|
34
35
|
try {
|
|
35
|
-
await rest.put(Routes.applicationCommands(this.client.user.id), {
|
|
36
|
+
await rest.put(Routes.applicationCommands(this.client.user.id), {
|
|
37
|
+
body: applicationCommands
|
|
38
|
+
});
|
|
36
39
|
logger.success("Application commands registered successfully");
|
|
37
40
|
}
|
|
38
41
|
catch (error) {
|
|
39
|
-
logger.error(`Error while registering application commands: ${error}`);
|
|
42
|
+
logger.error(`Error while registering application commands: ${error.stack}`);
|
|
40
43
|
}
|
|
41
44
|
}
|
|
42
45
|
};
|
|
@@ -83,7 +86,7 @@ export class StelliaUtils {
|
|
|
83
86
|
}
|
|
84
87
|
}
|
|
85
88
|
catch (error) {
|
|
86
|
-
logger.error(`Error while handling autocomplete interaction: ${error}`);
|
|
89
|
+
logger.error(`Error while handling autocomplete interaction: ${error.stack}`);
|
|
87
90
|
}
|
|
88
91
|
};
|
|
89
92
|
handleButtonInteraction = async (interaction) => {
|
|
@@ -92,7 +95,8 @@ export class StelliaUtils {
|
|
|
92
95
|
const buttonManager = this.client.managers.buttons;
|
|
93
96
|
if (!buttonManager)
|
|
94
97
|
return;
|
|
95
|
-
const button = buttonManager.getByCustomId(buttonInteraction.customId) ||
|
|
98
|
+
const button = buttonManager.getByCustomId(buttonInteraction.customId) ||
|
|
99
|
+
buttonManager.getByRegex(buttonInteraction.customId);
|
|
96
100
|
if (!button)
|
|
97
101
|
return;
|
|
98
102
|
if (this.client.environment.areGuildsConfigurationEnabled) {
|
|
@@ -106,7 +110,7 @@ export class StelliaUtils {
|
|
|
106
110
|
}
|
|
107
111
|
}
|
|
108
112
|
catch (error) {
|
|
109
|
-
logger.error(`Error while handling button interaction: ${error}`);
|
|
113
|
+
logger.error(`Error while handling button interaction: ${error.stack}`);
|
|
110
114
|
}
|
|
111
115
|
};
|
|
112
116
|
handleCommandInteraction = async (interaction) => {
|
|
@@ -129,7 +133,7 @@ export class StelliaUtils {
|
|
|
129
133
|
}
|
|
130
134
|
}
|
|
131
135
|
catch (error) {
|
|
132
|
-
logger.error(`Error while handling command interaction: ${error}`);
|
|
136
|
+
logger.error(`Error while handling command interaction: ${error.stack}`);
|
|
133
137
|
}
|
|
134
138
|
};
|
|
135
139
|
handleContextMenuInteraction = async (interaction) => {
|
|
@@ -145,7 +149,7 @@ export class StelliaUtils {
|
|
|
145
149
|
}
|
|
146
150
|
}
|
|
147
151
|
catch (error) {
|
|
148
|
-
logger.error(`Error while handling context menu interaction: ${error}`);
|
|
152
|
+
logger.error(`Error while handling context menu interaction: ${error.stack}`);
|
|
149
153
|
}
|
|
150
154
|
};
|
|
151
155
|
handleModalInteraction = async (interaction) => {
|
|
@@ -154,7 +158,8 @@ export class StelliaUtils {
|
|
|
154
158
|
const modalManager = this.client.managers.modals;
|
|
155
159
|
if (!modalManager)
|
|
156
160
|
return;
|
|
157
|
-
const modal = modalManager.getByCustomId(modalInteraction.customId) ||
|
|
161
|
+
const modal = modalManager.getByCustomId(modalInteraction.customId) ||
|
|
162
|
+
modalManager.getByRegex(modalInteraction.customId);
|
|
158
163
|
if (!modal)
|
|
159
164
|
return;
|
|
160
165
|
if (this.client.environment.areGuildsConfigurationEnabled) {
|
|
@@ -168,7 +173,7 @@ export class StelliaUtils {
|
|
|
168
173
|
}
|
|
169
174
|
}
|
|
170
175
|
catch (error) {
|
|
171
|
-
logger.error(`Error while handling modal interaction: ${error}`);
|
|
176
|
+
logger.error(`Error while handling modal interaction: ${error.stack}`);
|
|
172
177
|
}
|
|
173
178
|
};
|
|
174
179
|
handleSelectMenuInteraction = async (interaction) => {
|
|
@@ -177,7 +182,8 @@ export class StelliaUtils {
|
|
|
177
182
|
const selectMenuManager = this.client.managers.selectMenus;
|
|
178
183
|
if (!selectMenuManager)
|
|
179
184
|
return;
|
|
180
|
-
const selectMenu = selectMenuManager.getByCustomId(selectMenuInteraction.customId) ||
|
|
185
|
+
const selectMenu = selectMenuManager.getByCustomId(selectMenuInteraction.customId) ||
|
|
186
|
+
selectMenuManager.getByRegex(selectMenuInteraction.customId);
|
|
181
187
|
if (!selectMenu)
|
|
182
188
|
return;
|
|
183
189
|
if (this.client.environment.areGuildsConfigurationEnabled) {
|
|
@@ -191,7 +197,7 @@ export class StelliaUtils {
|
|
|
191
197
|
}
|
|
192
198
|
}
|
|
193
199
|
catch (error) {
|
|
194
|
-
logger.error(`Error while handling select menu interaction: ${error}`);
|
|
200
|
+
logger.error(`Error while handling select menu interaction: ${error.stack}`);
|
|
195
201
|
}
|
|
196
202
|
};
|
|
197
203
|
handleMessageContextMenuInteraction = async (interaction) => {
|
|
@@ -213,7 +219,7 @@ export class StelliaUtils {
|
|
|
213
219
|
}
|
|
214
220
|
}
|
|
215
221
|
catch (error) {
|
|
216
|
-
logger.error(`Error while handling message context menu interaction: ${error}`);
|
|
222
|
+
logger.error(`Error while handling message context menu interaction: ${error.stack}`);
|
|
217
223
|
}
|
|
218
224
|
};
|
|
219
225
|
handleUserContextMenuInteraction = async (interaction) => {
|
|
@@ -235,7 +241,7 @@ export class StelliaUtils {
|
|
|
235
241
|
}
|
|
236
242
|
}
|
|
237
243
|
catch (error) {
|
|
238
|
-
logger.error(`Error while handling user context menu interaction: ${error}`);
|
|
244
|
+
logger.error(`Error while handling user context menu interaction: ${error.stack}`);
|
|
239
245
|
}
|
|
240
246
|
};
|
|
241
247
|
getInteractionType(interaction) {
|
|
@@ -1,7 +1,7 @@
|
|
|
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
|
|
4
|
+
import { type InteractionCustomId, type StructureCustomId } from "../typescript/index.js";
|
|
5
5
|
export declare class AutoCompleteManager extends BaseManager {
|
|
6
6
|
private interactions;
|
|
7
7
|
constructor(client: StelliaClient, directory: string);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Collection } from "discord.js";
|
|
2
2
|
import { type StelliaClient } from "../client/index.js";
|
|
3
|
-
import { type StructureCustomId, type InteractionCustomId } from "../typescript/index.js";
|
|
4
3
|
import { type AnyInteractionStructure } from "../structures/index.js";
|
|
4
|
+
import { type InteractionCustomId, type StructureCustomId } from "../typescript/index.js";
|
|
5
5
|
export interface ManagerOptions {
|
|
6
6
|
directoryPath: string;
|
|
7
7
|
}
|
|
@@ -2,7 +2,7 @@ import { Collection } from "discord.js";
|
|
|
2
2
|
import { type StelliaClient } from "../client/index.js";
|
|
3
3
|
import { BaseManager } from "./index.js";
|
|
4
4
|
import { type ButtonStructure } from "../structures/index.js";
|
|
5
|
-
import { type
|
|
5
|
+
import { type InteractionCustomId, type StructureCustomId } from "../typescript/index.js";
|
|
6
6
|
export declare class ButtonManager extends BaseManager {
|
|
7
7
|
interactions: Collection<StructureCustomId, ButtonStructure>;
|
|
8
8
|
constructor(client: StelliaClient, directory: string);
|
|
@@ -1,7 +1,7 @@
|
|
|
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
|
|
4
|
+
import { type InteractionCustomId, type StructureCustomId } from "../typescript/index.js";
|
|
5
5
|
export declare class CommandManager extends BaseManager {
|
|
6
6
|
private interactions;
|
|
7
7
|
constructor(client: StelliaClient, directory: string);
|
|
@@ -1,7 +1,7 @@
|
|
|
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
|
|
4
|
+
import { type InteractionCustomId, type StructureCustomId } from "../typescript/index.js";
|
|
5
5
|
export declare class ContextMenuManager extends BaseManager {
|
|
6
6
|
private interactions;
|
|
7
7
|
constructor(client: StelliaClient, directory: string);
|
|
@@ -1,7 +1,7 @@
|
|
|
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
|
|
4
|
+
import { type InteractionCustomId, type StructureCustomId } from "../typescript/index.js";
|
|
5
5
|
export declare class EventManager extends BaseManager {
|
|
6
6
|
private interactions;
|
|
7
7
|
private guildsConfiguration;
|
|
@@ -8,12 +8,13 @@ export class EventManager extends BaseManager {
|
|
|
8
8
|
constructor(client, directoryPath) {
|
|
9
9
|
super(client, directoryPath);
|
|
10
10
|
if (this.client.environment.areGuildsConfigurationEnabled) {
|
|
11
|
-
this.client
|
|
11
|
+
this.client
|
|
12
|
+
.getGuildsConfiguration()
|
|
12
13
|
.then((guildsConfiguration) => {
|
|
13
14
|
this.guildsConfiguration = guildsConfiguration;
|
|
14
15
|
logger.success("Guilds configuration loaded successfully for event");
|
|
15
16
|
})
|
|
16
|
-
.catch((error) => logger.error(`Error while loading guilds configuration: ${error}`));
|
|
17
|
+
.catch((error) => logger.error(`Error while loading guilds configuration: ${error.stack}`));
|
|
17
18
|
}
|
|
18
19
|
}
|
|
19
20
|
async loadData() {
|
|
@@ -1,7 +1,7 @@
|
|
|
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
|
|
4
|
+
import { type InteractionCustomId, type StructureCustomId } from "../typescript/index.js";
|
|
5
5
|
export declare class ModalManager extends BaseManager {
|
|
6
6
|
private interactions;
|
|
7
7
|
constructor(client: StelliaClient, directory: string);
|
|
@@ -1,7 +1,7 @@
|
|
|
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
|
|
4
|
+
import { type InteractionCustomId, type StructureCustomId } from "../typescript/index.js";
|
|
5
5
|
export declare class SelectMenuManager extends BaseManager {
|
|
6
6
|
private interactions;
|
|
7
7
|
constructor(client: StelliaClient, directory: string);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { type AnySelectMenuInteraction, type AutocompleteInteraction, type Awaitable, type ButtonInteraction, type ChatInputCommandInteraction, type ContextMenuCommandType, type MessageContextMenuCommandInteraction, type ModalSubmitInteraction, type SlashCommandOptionsOnlyBuilder, type UserContextMenuCommandInteraction } from "discord.js";
|
|
1
|
+
import { type AnySelectMenuInteraction, type AutocompleteInteraction, type Awaitable, type ButtonInteraction, type ChatInputCommandInteraction, type ContextMenuCommandType, type MessageContextMenuCommandInteraction, type ModalSubmitInteraction, type SlashCommandOptionsOnlyBuilder, type SlashCommandSubcommandsOnlyBuilder, type UserContextMenuCommandInteraction } from "discord.js";
|
|
2
2
|
import { type StelliaClient } from "../client/index.js";
|
|
3
|
-
import { type GuildConfigurationType } from "../typescript/index.js";
|
|
4
3
|
import { type EventStructure } from "./Event.js";
|
|
4
|
+
import { type GuildConfigurationType } from "../typescript/index.js";
|
|
5
5
|
export interface AutoCompleteStructureWithGuildConfiguration extends MessageInteractionStructure {
|
|
6
6
|
execute(client: StelliaClient, guildConfiguration: GuildConfigurationType, interaction: AutocompleteInteraction<"cached">): Awaitable<unknown>;
|
|
7
7
|
}
|
|
@@ -46,7 +46,7 @@ export interface SelectMenuStructureWithoutGuildConfiguration extends MessageInt
|
|
|
46
46
|
export type SelectMenuStructure = SelectMenuStructureWithGuildConfiguration | SelectMenuStructureWithoutGuildConfiguration;
|
|
47
47
|
export type AnyInteractionStructure = AutoCompleteStructure | ButtonStructure | CommandStructure | ContextMenuStructure | EventStructure | ModalStructure | SelectMenuStructure;
|
|
48
48
|
interface CommandInteractionStructure {
|
|
49
|
-
data: SlashCommandOptionsOnlyBuilder;
|
|
49
|
+
data: SlashCommandOptionsOnlyBuilder | SlashCommandSubcommandsOnlyBuilder;
|
|
50
50
|
}
|
|
51
51
|
interface ContextMenuInteractionStructure {
|
|
52
52
|
data: ContextMenuDataStructure;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type AutoCompleteManager, type ButtonManager, type CommandManager, type ContextMenuManager, type EventManager, type ModalManager, type SelectMenuManager } from "../managers/index.js";
|
|
2
1
|
import { type Locale, type Snowflake } from "discord.js";
|
|
2
|
+
import { type AutoCompleteManager, type ButtonManager, type CommandManager, type ContextMenuManager, type EventManager, type ModalManager, type SelectMenuManager } from "../managers/index.js";
|
|
3
3
|
export type StructureCustomId = string | RegExp;
|
|
4
4
|
export type InteractionCustomId = string;
|
|
5
5
|
export declare enum InteractionType {
|
package/dist/utils/index.d.ts
CHANGED
package/dist/utils/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,29 +1,43 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
2
|
+
"name": "@stelliajs/framework",
|
|
3
|
+
"version": "1.4.6",
|
|
4
|
+
"main": "./dist/index.js",
|
|
5
|
+
"types": "./dist/index.d.ts",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"lint": "eslint . --ext .js",
|
|
8
|
+
"format": "prettier --write .",
|
|
9
|
+
"build": "tsc && tsc-alias"
|
|
10
|
+
},
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "https://github.com/stelliajs/framework.git"
|
|
14
|
+
},
|
|
15
|
+
"author": "Tweenty_",
|
|
16
|
+
"license": "ISC",
|
|
17
|
+
"description": "A framework for simplify the creation of discord bots",
|
|
18
|
+
"keywords": [
|
|
19
|
+
"discord",
|
|
20
|
+
"bot",
|
|
21
|
+
"discordjs",
|
|
22
|
+
"typescript",
|
|
23
|
+
"framework"
|
|
24
|
+
],
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"discord.js": "^14.21.0",
|
|
27
|
+
"i18next": "^25.3.2",
|
|
28
|
+
"log-symbols": "^7.0.1"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@eslint/js": "^9.32.0",
|
|
32
|
+
"@trivago/prettier-plugin-sort-imports": "^5.2.2",
|
|
33
|
+
"eslint": "^9.32.0",
|
|
34
|
+
"discord-api-types": "^0.38.16",
|
|
35
|
+
"globals": "^16.3.0",
|
|
36
|
+
"prettier": "^3.6.2",
|
|
37
|
+
"ts-node": "^10.9.2",
|
|
38
|
+
"tsc-alias": "^1.8.16",
|
|
39
|
+
"typescript-eslint": "^8.38.0"
|
|
40
|
+
},
|
|
41
|
+
"type": "module",
|
|
42
|
+
"packageManager": "pnpm@10.14.0"
|
|
29
43
|
}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { type BaseMessageOptions, type RepliableInteraction } from "discord.js";
|
|
2
|
-
export declare const ephemeralFollowUpResponse: (interaction: RepliableInteraction, data: string | BaseMessageOptions, automaticDeletion?: boolean) => Promise<void>;
|
|
3
|
-
export declare const ephemeralReplyResponse: (interaction: RepliableInteraction, data: BaseMessageOptions, automaticDeletion?: boolean) => Promise<void>;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { MessageFlags } from "discord.js";
|
|
2
|
-
export const ephemeralFollowUpResponse = async (interaction, data, automaticDeletion = false) => {
|
|
3
|
-
if (!interaction.deferred) {
|
|
4
|
-
await interaction.deferReply({ flags: MessageFlags.Ephemeral });
|
|
5
|
-
}
|
|
6
|
-
if (typeof data === "string") {
|
|
7
|
-
await interaction.followUp({ content: data, flags: MessageFlags.Ephemeral });
|
|
8
|
-
}
|
|
9
|
-
else {
|
|
10
|
-
await interaction.followUp({ ...data, flags: MessageFlags.Ephemeral });
|
|
11
|
-
}
|
|
12
|
-
if (automaticDeletion) {
|
|
13
|
-
setTimeout(() => {
|
|
14
|
-
try {
|
|
15
|
-
interaction.deleteReply();
|
|
16
|
-
}
|
|
17
|
-
catch { }
|
|
18
|
-
}, 60 * 1000);
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
export const ephemeralReplyResponse = async (interaction, data, automaticDeletion = false) => {
|
|
22
|
-
if (!interaction.deferred) {
|
|
23
|
-
await interaction.deferReply({ flags: MessageFlags.Ephemeral });
|
|
24
|
-
}
|
|
25
|
-
if (typeof data === "string") {
|
|
26
|
-
await interaction.reply({ content: data, flags: MessageFlags.Ephemeral });
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
await interaction.reply({ ...data, flags: MessageFlags.Ephemeral });
|
|
30
|
-
}
|
|
31
|
-
if (automaticDeletion) {
|
|
32
|
-
setTimeout(() => {
|
|
33
|
-
try {
|
|
34
|
-
interaction.deleteReply();
|
|
35
|
-
}
|
|
36
|
-
catch { }
|
|
37
|
-
}, 60 * 1000);
|
|
38
|
-
}
|
|
39
|
-
};
|