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

[bug] Member list is scrambled — order not respected

Đang mở
#363 2 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
TypeScript
Star
1.5k
Fork
108
Merge trung bình
14 giờ 5 phút
Pull request đã merge (30 ngày)
2

Mô tả

## 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)

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.