@minesa-org/mini-interaction 0.2.26 → 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.
|
@@ -195,7 +195,7 @@ export declare class MiniInteraction {
|
|
|
195
195
|
/**
|
|
196
196
|
* Creates a new MiniInteraction client with optional command auto-loading and custom runtime hooks.
|
|
197
197
|
*/
|
|
198
|
-
constructor(
|
|
198
|
+
constructor(options?: InteractionClientOptions);
|
|
199
199
|
private trackInteractionState;
|
|
200
200
|
/**
|
|
201
201
|
* Checks if an interaction can still respond (not expired and not already responded).
|
|
@@ -48,15 +48,15 @@ export class MiniInteraction {
|
|
|
48
48
|
/**
|
|
49
49
|
* Creates a new MiniInteraction client with optional command auto-loading and custom runtime hooks.
|
|
50
50
|
*/
|
|
51
|
-
constructor(
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
if (!resolvedPublicKey) {
|
|
58
|
-
throw new Error("[MiniInteraction] publicKey is required (or DISCORD_PUBLIC_KEY env var)");
|
|
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(() => { });
|
|
59
56
|
}
|
|
57
|
+
const { applicationId, publicKey, commandsDirectory, componentsDirectory, utilsDirectory, fetchImplementation, verifyKeyImplementation, timeoutConfig, } = options;
|
|
58
|
+
const resolvedAppId = applicationId ?? (typeof process !== "undefined" ? process.env.DISCORD_APPLICATION_ID : undefined);
|
|
59
|
+
const resolvedPublicKey = publicKey ?? (typeof process !== "undefined" ? (process.env.DISCORD_PUBLIC_KEY ?? process.env.DISCORD_APP_PUBLIC_KEY) : undefined);
|
|
60
60
|
const fetchImpl = fetchImplementation ?? globalThis.fetch;
|
|
61
61
|
if (typeof fetchImpl !== "function") {
|
|
62
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",
|