@theholocron/holocron-plugin-discord 5.0.0-alpha.422 → 5.0.0-alpha.424
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/README.md +4 -4
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +6 -6
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -23,7 +23,7 @@ Token resolution order:
|
|
|
23
23
|
2. `HOLOCRON_DISCORD_WEBHOOK` env var
|
|
24
24
|
3. `DISCORD_WEBHOOK_URL` env var
|
|
25
25
|
4. Keyring `discord.<org>` — tried first when an org is active via `--org`, `HOLOCRON_ORG`, or `org` in `holocron.config.ts`
|
|
26
|
-
5. Keyring `discord` — unnamespaced fallback; set via `holocron
|
|
26
|
+
5. Keyring `discord` — unnamespaced fallback; set via `holocron new token discord <webhook-url>`
|
|
27
27
|
|
|
28
28
|
The "token" is the full incoming webhook URL
|
|
29
29
|
(`https://discord.com/api/webhooks/{id}/{token}`). No bot account or
|
|
@@ -66,17 +66,17 @@ that need to split the URL into its parts.
|
|
|
66
66
|
|
|
67
67
|
## Provisioning
|
|
68
68
|
|
|
69
|
-
`holocron notifications
|
|
69
|
+
`holocron setup notifications` and `holocron new channel` create
|
|
70
70
|
channels, roles and webhooks through the `notifications` capability's `ensure*`
|
|
71
71
|
methods. They use the **Holonet bot**, not a webhook URL:
|
|
72
72
|
|
|
73
73
|
- `HOLOCRON_DISCORD_BOT_TOKEN` (or `DISCORD_BOT_TOKEN`), or the keyring entry
|
|
74
|
-
`discord.holonet` (`holocron
|
|
74
|
+
`discord.holonet` (`holocron new token discord.holonet <token>`) — the bot token
|
|
75
75
|
from the Developer Portal. Only read when a provisioning command runs, or when
|
|
76
76
|
`holocron doctor` checks a provider that has a `guildId`; posting never needs it.
|
|
77
77
|
- `HOLOCRON_DISCORD_CLIENT_SECRET` (or `DISCORD_CLIENT_SECRET`), or the keyring entry
|
|
78
78
|
`discord.holonet.oauth` — the application's OAuth client secret (Developer Portal →
|
|
79
|
-
OAuth2 → Reset Secret). Only `holocron
|
|
79
|
+
OAuth2 → Reset Secret). Only `holocron link account` reads it, to learn which
|
|
80
80
|
GitHub account a member owns; the API can neither create nor read it.
|
|
81
81
|
- `guildId` — the server id (not a secret), set in the provider options.
|
|
82
82
|
- `layout` — categories, channels (each optionally with a `webhook`) and roles.
|
package/dist/index.d.mts
CHANGED
|
@@ -25,9 +25,9 @@ interface DiscordNotificationsOptions {
|
|
|
25
25
|
* without an explicit channel, or with an empty string.
|
|
26
26
|
*/
|
|
27
27
|
defaultChannel?: string;
|
|
28
|
-
/** Discord server (guild) id that `notifications
|
|
28
|
+
/** Discord server (guild) id that `setup notifications` provisions. Not a secret. */
|
|
29
29
|
guildId?: string;
|
|
30
|
-
/** The server layout `notifications
|
|
30
|
+
/** The server layout `setup notifications` applies. */
|
|
31
31
|
layout?: NotificationsLayout;
|
|
32
32
|
/** A custom API host, for tests. Webhook tokens are only sent to it when `unsafeBotBaseUrl` is also set. */
|
|
33
33
|
baseUrl?: string;
|
|
@@ -394,6 +394,6 @@ export declare function createPlugin(options?: DiscordPluginOptions): {
|
|
|
394
394
|
notifications: () => Notifications;
|
|
395
395
|
};
|
|
396
396
|
};
|
|
397
|
-
/** One-line hint printed by `holocron
|
|
397
|
+
/** One-line hint printed by `holocron new token discord` when no webhook URL is supplied or the supplied one is rejected. */
|
|
398
398
|
export declare const AUTH_HINT: string;
|
|
399
399
|
export { AuthError, type DiscordClient, type DiscordClientOptions, type DiscordNotificationsOptions, type DiscordWebhookInfo, type ResolveTokenInput, type VerifyTokenFailure, type VerifyTokenResult, type VerifyTokenSuccess, createDiscordClient, parseWebhookUrl };
|
package/dist/index.mjs
CHANGED
|
@@ -27,21 +27,21 @@ const resolveToken = createResolveToken({
|
|
|
27
27
|
envName: "HOLOCRON_DISCORD_WEBHOOK",
|
|
28
28
|
vendorEnvName: "DISCORD_WEBHOOK_URL",
|
|
29
29
|
keyringService: "discord",
|
|
30
|
-
errorMessage: "no Discord webhook URL found. Pass --token <WEBHOOK_URL>, set HOLOCRON_DISCORD_WEBHOOK / DISCORD_WEBHOOK_URL, or run: holocron
|
|
30
|
+
errorMessage: "no Discord webhook URL found. Pass --token <WEBHOOK_URL>, set HOLOCRON_DISCORD_WEBHOOK / DISCORD_WEBHOOK_URL, or run: holocron new token discord <https://discord.com/api/webhooks/...>"
|
|
31
31
|
});
|
|
32
32
|
/** Resolves the Discord bot token used to provision channels, roles and webhooks, from `HOLOCRON_DISCORD_BOT_TOKEN`, `DISCORD_BOT_TOKEN` or the keyring. */
|
|
33
33
|
const resolveBotToken = createResolveToken({
|
|
34
34
|
envName: "HOLOCRON_DISCORD_BOT_TOKEN",
|
|
35
35
|
vendorEnvName: "DISCORD_BOT_TOKEN",
|
|
36
36
|
keyringService: "discord.holonet",
|
|
37
|
-
errorMessage: "no Discord bot token found. Set HOLOCRON_DISCORD_BOT_TOKEN (or DISCORD_BOT_TOKEN), or run: holocron
|
|
37
|
+
errorMessage: "no Discord bot token found. Set HOLOCRON_DISCORD_BOT_TOKEN (or DISCORD_BOT_TOKEN), or run: holocron new token discord.holonet <token> — it is the bot token from the Discord developer portal (Bot → Reset Token), not a webhook URL."
|
|
38
38
|
});
|
|
39
39
|
/** Resolves the Discord application's OAuth client secret used to sign members in, from `HOLOCRON_DISCORD_CLIENT_SECRET`, `DISCORD_CLIENT_SECRET` or the keyring. */
|
|
40
40
|
const resolveClientSecret = createResolveToken({
|
|
41
41
|
envName: "HOLOCRON_DISCORD_CLIENT_SECRET",
|
|
42
42
|
vendorEnvName: "DISCORD_CLIENT_SECRET",
|
|
43
43
|
keyringService: "discord.holonet.oauth",
|
|
44
|
-
errorMessage: "no Discord client secret found. Set HOLOCRON_DISCORD_CLIENT_SECRET (or DISCORD_CLIENT_SECRET), or run: holocron
|
|
44
|
+
errorMessage: "no Discord client secret found. Set HOLOCRON_DISCORD_CLIENT_SECRET (or DISCORD_CLIENT_SECRET), or run: holocron new token discord.holonet.oauth <secret> — it is the client secret from the developer portal (OAuth2 → Reset Secret), which the API cannot create or read."
|
|
45
45
|
});
|
|
46
46
|
/**
|
|
47
47
|
* Every token this plugin takes, for `holocron doctor tokens`. `verifyToken` checks a webhook URL, so the bot token has
|
|
@@ -2033,7 +2033,7 @@ var DiscordNotifications = class DiscordNotifications {
|
|
|
2033
2033
|
/** The one role with this name, or an error that says what to fix: none, or more than one. */
|
|
2034
2034
|
async roleNamed(name) {
|
|
2035
2035
|
const matches = (await this.bot().guilds.roles(this.guild())).filter((r) => DiscordNotifications.same(r.name, name));
|
|
2036
|
-
if (matches.length === 0) throw new Error(`no role named \`${name}\` — run \`holocron notifications
|
|
2036
|
+
if (matches.length === 0) throw new Error(`no role named \`${name}\` — run \`holocron setup notifications\` to create it`);
|
|
2037
2037
|
if (matches.length > 1) throw new Error(`${matches.length} roles are named \`${name}\` (ids ${matches.map((r) => r.id).join(", ")}) — delete or rename the extras so it is clear which one to manage`);
|
|
2038
2038
|
return matches[0];
|
|
2039
2039
|
}
|
|
@@ -2250,6 +2250,6 @@ function createPlugin(options = {}) {
|
|
|
2250
2250
|
capabilities: { notifications: () => notifications(ctx) }
|
|
2251
2251
|
};
|
|
2252
2252
|
}
|
|
2253
|
-
/** One-line hint printed by `holocron
|
|
2254
|
-
const AUTH_HINT = "create a webhook in Discord: open your server → channel settings → Integrations → Webhooks → New Webhook, copy the webhook URL, then run: holocron
|
|
2253
|
+
/** One-line hint printed by `holocron new token discord` when no webhook URL is supplied or the supplied one is rejected. */
|
|
2254
|
+
const AUTH_HINT = "create a webhook in Discord: open your server → channel settings → Integrations → Webhooks → New Webhook, copy the webhook URL, then run: holocron new token discord <https://discord.com/api/webhooks/...>";
|
|
2255
2255
|
export { AUTH_HINT, AuthError, DiscordNotifications, createContext, createDiscordClient, createPlugin, notifications, parseWebhookUrl, resolveBotToken, resolveClientSecret, resolveToken, tokens, verifyToken };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theholocron/holocron-plugin-discord",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.424",
|
|
4
4
|
"description": "Holocron plugin for Discord. Implements the notifications capability via Discord incoming webhooks.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"discord",
|
|
@@ -41,19 +41,19 @@
|
|
|
41
41
|
"tsx": "4.23.15",
|
|
42
42
|
"typescript": "^5.9.3",
|
|
43
43
|
"vitest": "^5.1.0",
|
|
44
|
-
"@theholocron/cli": "5.0.0-alpha.
|
|
45
|
-
"@theholocron/
|
|
46
|
-
"@theholocron/
|
|
47
|
-
"@theholocron/
|
|
44
|
+
"@theholocron/cli": "5.0.0-alpha.424",
|
|
45
|
+
"@theholocron/discord-client": "^1.58.0-alpha.29",
|
|
46
|
+
"@theholocron/eslint-config": "^8.9.0-alpha.17",
|
|
47
|
+
"@theholocron/http-client": "^1.58.0-alpha.29",
|
|
48
48
|
"@theholocron/misc-utils": "^1.17.0-alpha.4",
|
|
49
|
-
"@theholocron/
|
|
50
|
-
"@theholocron/
|
|
51
|
-
"@theholocron/vitest-config": "^8.9.0-alpha.
|
|
49
|
+
"@theholocron/tsconfig": "^8.9.0-alpha.17",
|
|
50
|
+
"@theholocron/tsdown-config": "^8.9.0-alpha.17",
|
|
51
|
+
"@theholocron/vitest-config": "^8.9.0-alpha.17"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
54
|
"@theholocron/discord-client": "^1.50.0",
|
|
55
55
|
"@theholocron/misc-utils": "^1.16.0",
|
|
56
|
-
"@theholocron/cli": "5.0.0-alpha.
|
|
56
|
+
"@theholocron/cli": "5.0.0-alpha.424"
|
|
57
57
|
},
|
|
58
58
|
"engines": {
|
|
59
59
|
"node": ">=22"
|