mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-09 13:21:42 +00:00
fix(discord): truncate thread titles by UTF-16 units + AUTHOR_MAP
Discord thread names share the same UTF-16 component budget as select labels and buttons — route the sanitizers in gateway/run.py and the adapter's rename_thread through utf16_len/_prefix_within_utf16_limit instead of code-point slices. Adds rungmc357 to AUTHOR_MAP.
This commit is contained in:
parent
0d9ed9214d
commit
1deeaf71ab
3 changed files with 16 additions and 5 deletions
|
|
@ -5271,8 +5271,11 @@ class DiscordAdapter(BasePlatformAdapter):
|
|||
cleaned = re.sub(r"\s+", " ", str(name or "")).strip()
|
||||
if not cleaned:
|
||||
return False
|
||||
if len(cleaned) > 80:
|
||||
cleaned = cleaned[:77].rstrip() + "..."
|
||||
# Discord thread names are budgeted in UTF-16 code units (emoji count
|
||||
# double) — truncate with the UTF-16 helpers, not code-point slices.
|
||||
from gateway.platforms.base import utf16_len, _prefix_within_utf16_limit
|
||||
if utf16_len(cleaned) > 80:
|
||||
cleaned = _prefix_within_utf16_limit(cleaned, 77).rstrip() + "..."
|
||||
|
||||
try:
|
||||
thread = self._client.get_channel(thread_id_int)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue