@minesa-org/mini-interaction 0.0.1 → 0.0.2
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.
|
@@ -164,6 +164,14 @@ export declare class MiniInteraction {
|
|
|
164
164
|
* Resolves the absolute commands directory path from configuration.
|
|
165
165
|
*/
|
|
166
166
|
private resolveCommandsDirectory;
|
|
167
|
+
/**
|
|
168
|
+
* Resolves the absolute components directory path from configuration.
|
|
169
|
+
*/
|
|
170
|
+
private resolveComponentsDirectory;
|
|
171
|
+
/**
|
|
172
|
+
* Resolves a directory relative to the compiled file with optional overrides.
|
|
173
|
+
*/
|
|
174
|
+
private resolveDirectory;
|
|
167
175
|
/**
|
|
168
176
|
* Handles execution of a message component interaction.
|
|
169
177
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { readdir, stat } from "node:fs/promises";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
import { pathToFileURL } from "node:url";
|
|
3
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
4
4
|
import { InteractionResponseType, InteractionType, } from "discord-api-types/v10";
|
|
5
5
|
import { verifyKey } from "discord-interactions";
|
|
6
6
|
import { DISCORD_BASE_URL } from "../utils/constants.js";
|
|
@@ -467,12 +467,27 @@ export class MiniInteraction {
|
|
|
467
467
|
* Resolves the absolute commands directory path from configuration.
|
|
468
468
|
*/
|
|
469
469
|
resolveCommandsDirectory(commandsDirectory) {
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
470
|
+
return this.resolveDirectory("../commands", commandsDirectory);
|
|
471
|
+
}
|
|
472
|
+
/**
|
|
473
|
+
* Resolves the absolute components directory path from configuration.
|
|
474
|
+
*/
|
|
475
|
+
resolveComponentsDirectory(componentsDirectory) {
|
|
476
|
+
return this.resolveDirectory("../components", componentsDirectory);
|
|
477
|
+
}
|
|
478
|
+
/**
|
|
479
|
+
* Resolves a directory relative to the compiled file with optional overrides.
|
|
480
|
+
*/
|
|
481
|
+
resolveDirectory(defaultRelativePath, overrideDirectory) {
|
|
482
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
483
|
+
const __dirname = path.dirname(__filename);
|
|
484
|
+
const defaultDir = path.resolve(__dirname, defaultRelativePath);
|
|
485
|
+
if (!overrideDirectory) {
|
|
486
|
+
return defaultDir;
|
|
487
|
+
}
|
|
488
|
+
return path.isAbsolute(overrideDirectory)
|
|
489
|
+
? overrideDirectory
|
|
490
|
+
: path.resolve(process.cwd(), overrideDirectory);
|
|
476
491
|
}
|
|
477
492
|
/**
|
|
478
493
|
* Handles execution of a message component interaction.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@minesa-org/mini-interaction",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"description": "Mini interaction, connecting your app with Discord via HTTP-interaction (Vercel support).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -47,4 +47,4 @@
|
|
|
47
47
|
"ts-node": "^10.9.2",
|
|
48
48
|
"typescript": "^5.9.3"
|
|
49
49
|
}
|
|
50
|
-
}
|
|
50
|
+
}
|