aiko-chan-ai / aiko-chan-ai/DiscordBotClient

[bug] Member list is scrambled — order not respected

Offen
#363 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
TypeScript
Sterne
1.5k
Forks
108
Ø Merge
14 Std. 5 Min.
Gemergte PRs (30 T.)
2

Beschreibung

## Bug

The guild member list is **scrambled** — it doesn't respect member ordering. Members within a role section are not alphabetical (nor in any meaningful order); the sequence looks shuffled/random and appears to be server-sent order that the client renders verbatim.

## Root cause (verified)

The sidebar member list is fed by `ChannelMemberStore` (webpack module `963307` in the Discord webapp bundle build 589596 / `web.6d63a33a2f3badf3.js`), which copies `GUILD_MEMBER_LIST_UPDATE` ops **verbatim** into a flat `rows` array (`SYNC`/`INSERT`/`UPDATE`/`DELETE`/`INVALIDATE` + `setGroups`) with no client-side sorting. Discord's real client relies on the server sending rows already ordered by presence. For a **bot account (no presence data — all offline)**, the server orders members within each role group by user-ID/join order, which looks scrambled in the UI.

- The member-list panel component reads `ChannelMemberStore.getProps(guildId, channelId)` → `{groups, rows, version}` and renders `rows` as-is.
- GROUP rows (role sections) are `{type: "GROUP", index, count, title}`; MEMBER rows carry `nick` / `user.globalName` / `user.username`.

## Fix (confirmed working)

Re-sort the MEMBER rows alphabetically (nick → globalName → username, case-insensitive) within each GROUP section, preserving the role-hierarchy order of the GROUP rows. Requires only wrapping the store's `getProps`/`getRows` to return a sorted copy of `rows`. Tested successfully on v3.9.3 via a small injected script that hooks webpack and wraps `ChannelMemberStore`.

## Suggestion

Consider patching Discord server responses in the main process, or sorting `ChannelMemberStore` rows client-side, since bots will always receive this ordering from Discord.

## Environment

- DiscordBotClient v3.9.3 (Windows)
- Discord webapp build: BUNDLE 589596, VERSION_HASH `95c90b96…` (2026-08-07 snapshot)

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.