fix: resolve Discord usernames to user IDs for outbound messages#2649
Merged
thewilloftheshadow merged 6 commits intoopenclaw:mainfrom Jan 28, 2026
Merged
Conversation
When sending Discord messages via cron jobs or the message tool, usernames like "john.doe" were incorrectly treated as channel names, causing silent delivery failures. This fix adds a resolveDiscordTarget() function that: - Queries Discord directory to resolve usernames to user IDs - Falls back to standard parsing for known formats - Enables sending DMs by username without requiring explicit user:ID format Changes: - Added resolveDiscordTarget() in targets.ts with directory lookup - Added parseAndResolveRecipient() in send.shared.ts - Updated all outbound send functions to use username resolution Fixes openclaw#2627
834396c to
f2f85bb
Compare
Member
|
Landed via temp rebase onto main.
Thanks @nonggialiang! |
jsholmes
added a commit
to jsholmes/clawdbot
that referenced
this pull request
Jan 28, 2026
The upstream PR openclaw#2649 merged with incorrect import paths: - DirectoryConfigParams and ChannelDirectoryEntry were imported from '../channels/targets.js' but actually exist in the plugins directory. Fixes: - Import DirectoryConfigParams from '../channels/plugins/directory-config.js' - Remove unused ChannelDirectoryEntry import - Fix parseDiscordTarget() calls in resolveDiscordTarget() to not pass incompatible DirectoryConfigParams to MessagingTargetParseOptions This fixes the TypeScript build error introduced by upstream commit 7958ead.
YuriNachos
pushed a commit
to YuriNachos/clawdbot-fork
that referenced
this pull request
Jan 31, 2026
YuriNachos
pushed a commit
to YuriNachos/clawdbot-fork
that referenced
this pull request
Jan 31, 2026
YuriNachos
pushed a commit
to YuriNachos/clawdbot-fork
that referenced
this pull request
Jan 31, 2026
YuriNachos
pushed a commit
to YuriNachos/clawdbot-fork
that referenced
this pull request
Jan 31, 2026
YuriNachos
pushed a commit
to YuriNachos/clawdbot-fork
that referenced
this pull request
Jan 31, 2026
YuriNachos
pushed a commit
to YuriNachos/clawdbot-fork
that referenced
this pull request
Jan 31, 2026
YuriNachos
pushed a commit
to YuriNachos/clawdbot-fork
that referenced
this pull request
Jan 31, 2026
YuriNachos
pushed a commit
to YuriNachos/clawdbot-fork
that referenced
this pull request
Jan 31, 2026
YuriNachos
pushed a commit
to YuriNachos/clawdbot-fork
that referenced
this pull request
Jan 31, 2026
YuriNachos
pushed a commit
to YuriNachos/clawdbot-fork
that referenced
this pull request
Feb 1, 2026
YuriNachos
pushed a commit
to YuriNachos/clawdbot-fork
that referenced
this pull request
Feb 1, 2026
YuriNachos
pushed a commit
to YuriNachos/clawdbot-fork
that referenced
this pull request
Feb 1, 2026
YuriNachos
pushed a commit
to YuriNachos/clawdbot-fork
that referenced
this pull request
Feb 1, 2026
YuriNachos
pushed a commit
to YuriNachos/clawdbot-fork
that referenced
this pull request
Feb 1, 2026
bestNiu
pushed a commit
to bestNiu/clawdbot
that referenced
this pull request
Feb 5, 2026
zooqueen
pushed a commit
to hanzoai/bot
that referenced
this pull request
Mar 6, 2026
lovewanwan
pushed a commit
to lovewanwan/openclaw
that referenced
this pull request
Apr 28, 2026
ogt-redknie
pushed a commit
to ogt-redknie/OPENX
that referenced
this pull request
May 2, 2026
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
May 9, 2026
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.
Summary
Fixes #2627
When sending Discord messages via cron jobs or the message tool, usernames like `john.doe` were incorrectly treated as channel names, causing silent delivery failures.
Problem
The Discord outbound adapter had no `resolveTarget` hook. The `parseDiscordTarget()` function fell back to treating unrecognized strings as channel names:
```typescript
return buildMessagingTarget("channel", trimmed, trimmed);
```
So `john.doe` was passed as a channel name lookup, which fails because no channel named `john.doe` exists.
Solution
This fix adds a `resolveDiscordTarget()` function that:
Changes
Testing
After this fix, cron jobs can target usernames:
```json
{
"to": "john.doe",
"channel": "discord"
}
```
The username will be resolved to a Discord user ID, and the message will be delivered as a DM.
Note: This is a first step. For username resolution to work, Discord directory integration must be configured and bot must have access to guild member lists.