Files
openhuman/app/src-tauri
24b892439d feat(channels): Discord server/channel wiring and picker (#289) (#349)
* feat(channels): add channel_id to DiscordConfig schema

Add optional channel_id field to DiscordConfig for restricting the bot
to a specific Discord channel, matching the pattern used by SlackConfig
and MattermostConfig.

Refs: #289

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat(channels): add channel_id field to Discord definition

Expose channel_id as an optional field in the Discord BotToken auth mode
so users can specify a default channel for outbound messages via the UI.

Refs: #289

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat(channels): create Discord API helper module for guild/channel discovery

Refactor discord.rs into discord/ folder module and add api.rs with:
- list_bot_guilds: GET /users/@me/guilds
- list_guild_channels: GET /guilds/{id}/channels (filtered to text channels)
- check_channel_permissions: compute bot permissions from roles + overwrites

Includes unit tests for type serialization and permission bit constants.

Refs: #289

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat(channels): add Discord RPC handlers for guild/channel discovery

Add three new RPC endpoints:
- openhuman.channels_discord_list_guilds: list servers the bot is in
- openhuman.channels_discord_list_channels: list text channels in a guild
- openhuman.channels_discord_check_permissions: validate bot permissions

These retrieve the stored Discord bot token from credentials and call
the Discord REST API directly from the Rust core.

Refs: #289

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat(channels): wire channel_id into Discord provider for channel filtering

Add channel_id field to DiscordChannel struct and update all construction
sites. When channel_id is set, the listen loop only processes messages
from that specific channel, enabling server+channel-scoped operation.

Refs: #289

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat(channels): add Discord guild/channel API types and RPC methods

Add TypeScript types for DiscordGuild, DiscordTextChannel, and
BotPermissionCheck. Wire up three new RPC methods in channelConnectionsApi
for listing guilds, listing channels, and checking bot permissions.

Refs: #289

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat(channels): create DiscordServerChannelPicker component

Add server and channel selection UI that loads guilds and channels from
the Discord API via the Rust core RPC. Includes permission checking with
visual feedback for missing permissions.

Refs: #289

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat(channels): integrate server/channel picker into DiscordConfig

Show DiscordServerChannelPicker below the connect buttons when the
bot_token connection is active. Guild and channel selections flow back
into the credential field values for persistence.

Refs: #289

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* test(channels): add unit tests for Discord channel_id and config serde

Add tests for:
- DiscordConfig TOML/JSON deserialization with and without channel_id
- channel_id field storage on DiscordChannel struct
- Config roundtrip serialization

Refs: #289

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* test(channels): add Vitest tests for DiscordServerChannelPicker

Test guild loading, rendering, and placeholder states with mocked
RPC responses. Verifies the component renders heading, loads guilds
from the mock, and shows the select placeholder.

Refs: #289

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(ci): resolve discord module conflict and format drift

* fix(reviews): address CodeRabbit Discord picker and permission issues

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-06 17:35:55 +05:30
..
2026-03-29 10:30:18 -07:00
2026-03-29 10:30:18 -07:00
2026-03-29 10:30:18 -07:00
2026-04-06 06:16:27 +00:00
2026-04-06 06:16:27 +00:00