---
name: "Element tab-completion display name breaks bot command matching"
---

# Bug 447: Element tab-completion display name breaks bot command matching

## Description

When a user tab-completes a bot mention in Element, the Matrix client inserts the display name (e.g. `timmy ⚡️`) rather than the user ID (`@timmy`). If the display name contains emoji or special characters, the `strip_bot_mention` function in chat::util may fail to match it against the bot name, causing commands like `ambient on` to not be recognized.

## How to Reproduce

1. Set bot display_name to include emoji (e.g. `timmy ⚡️`) in bot.toml\n2. In Element, tab-complete the bot name to get `timmy ⚡️`\n3. Send `timmy ⚡️ ambient on`\n4. The bot does not respond — command not matched

## Actual Result

Bot ignores the command. The display name with emoji doesn't match during strip_bot_mention, so the command text is not correctly extracted.

## Expected Result

Bot should recognize commands regardless of whether the mention was tab-completed with the display name (including emoji) or typed manually as @localpart.

## Acceptance Criteria

- [ ] strip_bot_mention handles display names containing emoji and special characters
- [ ] strip_bot_mention handles Element's tab-completion format (display name followed by colon or comma)
- [ ] Commands work whether the user types @timmy, timmy, or tab-completes timmy ⚡️
