Skip to main content

Module service_discord

Module service_discord 

Source
Expand description

Discord’s plug-in to the generic service lifecycle.

Everything in this file is Discord-specific — scope names, prompts for application ID and default guild, the shape of the Discord credential (DiscordSecrets = one bot token), and the call that validates the token against the Discord API. The generic plumbing (flag parsing, path resolution, JSON envelopes, human banners, keychain I/O sequencing) lives in src/cli/lifecycle.rs and is shared with every other service.

See docs/services.md#adding-a-new-service for the recipe a new service would follow. This file is the first — and, until Telegram/Slack/etc. land, only — implementation of that recipe.

Structs§

CreateArgs
DiscordLifecycle
DiscordSecrets
Discord only uses one secret — the long-lived bot token — so Secrets wraps it in a named struct rather than String for parity with services that need richer shapes.

Functions§

validate_self_user
Validate a Discord user-ID string: numeric snowflake that resolves via GET /users/{id}. Shared between the create-time path and zad discord self set. Returns the canonical string form (not the parsed u64) because the config field is already a String.