Repository navigation
🚀 [Feature]: Discord bot and user client foundation - #15
Draft
Marius Storhaug (MariusStorhaug) wants to merge 13 commits into
Draft
Marius Storhaug (MariusStorhaug) wants to merge 13 commits into
Marius Storhaug (MariusStorhaug) wants to merge 13 commits into
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
| contents: read | ||
| pages: write | ||
| id-token: write | ||
| uses: PSModule/Process-PSModule/.github/workflows/workflow.yml@v8 |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Discord provides a reusable PowerShell client for bot access and interactive OAuth2 user sign-in. Connections use encrypted Context storage and are restored by name or default selection. At the user's request, the repository also moves to the current Process-PSModule v8 framework with explicit CI secrets, Pester 6, and real integration tests instead of mocks. The PR remains draft: the required test-bot secret is not configured, so authenticated integration and the coverage gate are not yet verified.
New: Authentication and saved contexts
Connect-DiscordAccount(Connect-Discord) accepts a bot token or a configured confidential OAuth2 application. User sign-in validates the callback state and issuer, uses S256 PKCE, requestsidentifyby default, and implements token refresh. Normal account session tokens and self-bot automation are not supported.Get-DiscordContext,Switch-DiscordContext, andDisconnect-DiscordAccount(Disconnect-Discord) manage named local connections and their default selection. Credentials stay SecureStrings and are encrypted by Context.Get-DiscordViewerretrieves/users/@me.New: Reusable REST client
Invoke-DiscordAPIusesBotorBearerauthorization and accepts only Discord's HTTPS v10 API destinations. It returnsRequest,Response,Headers,StatusCode, andStatusDescription; request metadata contains no authorization headers or body. GET/HEAD dictionaries become encoded query parameters, including lowercase Boolean values. HTTP 429 retries honor Discord's delay; other failures throw. No MCP server, Gateway connection, or resource-management command expansion is included.Changed: Pipeline and documentation
The caller uses the owned
v8framework pointer, explicitTestData, Pester 6.1+ within the 6.x line, and the existing release-label semantics. Tests rely on the framework's built-module import, use public interfaces, and contain no mocks or fallback target imports. Optional live server/channel reads use existing resources; no Discord resource is created, edited, or deleted.Zensical replaces the obsolete MkDocs configuration. Logo bytes, social links, consent, navigation expansion, and palette controls are preserved; fonts and features follow the template baseline. The README includes bot setup, user OAuth2 configuration, scopes, credentials, Context behavior, REST usage, and pipeline requirements.
Breaking Changes
The template
Get-PSModuleTestgreeting is replaced by client commands. PowerShell 7.4+ and Context 8.1.3+ are required. The framework's oldAPIKeyinput becomesPSGALLERY_API_KEY, with GitHub API operations using the existing organization App credentials.Adopting this release
http://localhost:53682/. User self-identity needsidentify; the guild-list example additionally requestsguilds.DISCORD_BOT_TOKENfor live CI. Optional variablesDISCORD_TEST_GUILD_IDandDISCORD_TEST_CHANNEL_IDidentify existing test resources. Install the bot in that server and allow it to view the channel; no Administrator, privileged intents, or message-sending permission is needed by these tests.PSGALLERY_API_KEY,SHELLY_CLIENT_ID, andSHELLY_PRIVATE_KEY. They are already available here through organization secrets. The existing workflow was re-enabled with user approval.Release impact
Decision source:
release:minor, explicitly mapped in.github/PSModule.ymlalongside the existing prefixed labels and retained legacy labels. This is a stable minor change from the pre-1.0v0.0.5baseline, with breaking integration changes described above. Final version and release coordinates are resolved by the release process.Technical details
Consumer change record
Template baseline
Process-PSModule v8.0.7 inspected at immutable source
105e4dcefe1946782066aa50a5c7d3658319895a. The caller follows the owned v8 major contract. Template-PSModule inspected atff935a5745db222c5f28e59df45931b617c2c50b. Discord retains its existing 50% coverage target and linter overrides. The consumer had no authored docs tree or custom assets;.github/zensical.tomluses the template's generated-site layout, verified through the native framework site build and a local build with the same structuring/postprocessing steps.Maintainer evidence
Implementation, tests, workflow, query correction, and documentation are split into small commits. GitHub/Context reference checkouts were inspected read-only. Context's vault key is held in ID/Name; the Discord snowflake remains separate in UserID. Official OAuth prose documents confidential exchange/refresh, and official metadata advertises S256 PKCE.
DISCORD_BOT_TOKENis missing; its 2 optional resource tests are skipped because their variables are absent. This is not reported as a passing integration run. The 50% coverage gate remains open.The initial PR planner's output was suppressed by GitHub's credential redaction. The latest native PR run executes the actual checks after rendering scheme names as code in the PR body; it is no longer a skipped-only success. The local Windows builder separately encounters mixed framework-generated line endings at formatting; the official Ubuntu-built artifact imports and works on Windows without a test bootstrap. The owned
@v8reference is the documented framework contract; zizmor's blanket SHA-only finding is that owned-major exception, not an undisclosed pin change.Scoped issue discovery returned no open Discord issues. The draft stays open until the bot fixture, real integration, and coverage gate pass.
Relevant issues (or links)