@minesa-org/mini-interaction 0.2.27 → 0.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.
|
@@ -49,15 +49,14 @@ export class MiniInteraction {
|
|
|
49
49
|
* Creates a new MiniInteraction client with optional command auto-loading and custom runtime hooks.
|
|
50
50
|
*/
|
|
51
51
|
constructor(options = {}) {
|
|
52
|
+
// Attempt to load .env if dotenv is available (non-blocking)
|
|
53
|
+
if (typeof process !== "undefined" && !process.env.DISCORD_APPLICATION_ID) {
|
|
54
|
+
// @ts-ignore - Optional dependency, may not have types available during build
|
|
55
|
+
import("dotenv/config").catch(() => { });
|
|
56
|
+
}
|
|
52
57
|
const { applicationId, publicKey, commandsDirectory, componentsDirectory, utilsDirectory, fetchImplementation, verifyKeyImplementation, timeoutConfig, } = options;
|
|
53
58
|
const resolvedAppId = applicationId ?? (typeof process !== "undefined" ? process.env.DISCORD_APPLICATION_ID : undefined);
|
|
54
59
|
const resolvedPublicKey = publicKey ?? (typeof process !== "undefined" ? (process.env.DISCORD_PUBLIC_KEY ?? process.env.DISCORD_APP_PUBLIC_KEY) : undefined);
|
|
55
|
-
if (!resolvedAppId) {
|
|
56
|
-
throw new Error("[MiniInteraction] applicationId is required (or DISCORD_APPLICATION_ID env var)");
|
|
57
|
-
}
|
|
58
|
-
if (!resolvedPublicKey) {
|
|
59
|
-
throw new Error("[MiniInteraction] publicKey is required (or DISCORD_PUBLIC_KEY env var)");
|
|
60
|
-
}
|
|
61
60
|
const fetchImpl = fetchImplementation ?? globalThis.fetch;
|
|
62
61
|
if (typeof fetchImpl !== "function") {
|
|
63
62
|
throw new Error("[MiniInteraction] fetch is not available. Provide a global fetch implementation.");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@minesa-org/mini-interaction",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
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",
|
|
@@ -40,8 +40,11 @@
|
|
|
40
40
|
},
|
|
41
41
|
"homepage": "https://github.com/minesa-org/mini-interaction#readme",
|
|
42
42
|
"dependencies": {
|
|
43
|
+
"@vercel/functions": "^1.6.0",
|
|
43
44
|
"discord-api-types": "^0.38.32",
|
|
44
|
-
"discord-interactions": "^4.4.0"
|
|
45
|
+
"discord-interactions": "^4.4.0",
|
|
46
|
+
"dotenv": "^17.2.3",
|
|
47
|
+
"mongodb": "^7.0.0"
|
|
45
48
|
},
|
|
46
49
|
"devDependencies": {
|
|
47
50
|
"@types/node": "^24.10.0",
|