Compare commits

..

7 Commits

Author SHA1 Message Date
copilot-swe-agent[bot]
8e8b874419 Improve: Use explicit conversion and keep descriptive names for 'all'
- Use explicit conditional for user_id conversion instead of || operator
- Keep '全体成员' for nickname/card so clients can display meaningful text

Co-authored-by: sj817 <74231782+sj817@users.noreply.github.com>
2025-11-07 10:49:24 +00:00
copilot-swe-agent[bot]
af4865e043 Fix: Skip UID conversion for user_id='all' in GetGroupMemberInfo
When user_id='all' or '0', return minimal member data without attempting UID conversion. This allows @all mentions to be processed normally without throwing Uin2Uid errors.

Co-authored-by: sj817 <74231782+sj817@users.noreply.github.com>
2025-11-07 10:45:45 +00:00
copilot-swe-agent[bot]
b6117ed205 Fix: Return mock data for user_id='all' in GetGroupMemberInfo
Instead of throwing an error, return a special mock member object representing "all members" when user_id='all'. This allows @all mentions to be processed normally without errors.

Co-authored-by: sj817 <74231782+sj817@users.noreply.github.com>
2025-11-07 10:33:35 +00:00
copilot-swe-agent[bot]
76bf3719f1 Fix: Update comment to Chinese for consistency
Co-authored-by: sj817 <74231782+sj817@users.noreply.github.com>
2025-11-07 10:21:32 +00:00
copilot-swe-agent[bot]
f3b9f1916f Fix: Add validation for user_id='all' in group member actions
Add early validation to reject user_id='all' with clear error messages in:
- GetGroupMemberInfo
- SetGroupKick
- SetGroupAdmin
- SetGroupBan
- SetGroupCard

This prevents "Uin2Uid Error: 用户ID all 不存在" when receiving @all mentions.

Co-authored-by: sj817 <74231782+sj817@users.noreply.github.com>
2025-11-07 10:19:06 +00:00
copilot-swe-agent[bot]
8e8fc471ed Initial exploration - understanding the bug
Co-authored-by: sj817 <74231782+sj817@users.noreply.github.com>
2025-11-07 10:15:13 +00:00
copilot-swe-agent[bot]
21de6660db Initial plan 2025-11-07 10:10:04 +00:00
2 changed files with 35 additions and 9 deletions

View File

@@ -41,6 +41,30 @@ class GetGroupMemberInfo extends OneBotAction<Payload, OB11GroupMember> {
}
async _handle (payload: Payload) {
// 处理 @全体成员 的特殊情况,跳过 UID 转换直接返回
if (payload.user_id === 'all' || payload.user_id === '0') {
return {
group_id: +payload.group_id,
user_id: payload.user_id === 'all' ? 0 : +payload.user_id,
nickname: '全体成员',
card: '全体成员',
sex: 'unknown' as const,
age: 0,
area: '',
level: '0',
qq_level: 0,
join_time: 0,
last_sent_time: 0,
title_expire_time: 0,
unfriendly: false,
card_changeable: false,
is_robot: false,
shut_up_timestamp: 0,
role: 'member' as const,
title: '',
};
}
const isNocache = this.parseBoolean(payload.no_cache ?? true);
const uid = await this.getUid(payload.user_id);
const member = await this.getGroupMemberInfo(payload, uid, isNocache);

View File

@@ -347,19 +347,21 @@ export class NapCatOneBot11Adapter {
peerUid: uid,
guildId: '',
};
const msg = (await this.core.apis.MsgApi.queryMsgsWithFilterExWithSeq(peer, msgSeq)).msgList.find(e => e.msgType === NTMsgType.KMSGTYPEGRAYTIPS);
let msg = (await this.core.apis.MsgApi.queryMsgsWithFilterExWithSeq(peer, msgSeq)).msgList.find(e => e.msgType === NTMsgType.KMSGTYPEGRAYTIPS);
const element = msg?.elements.find(e => !!e.grayTipElement?.revokeElement);
// Clean up recall event cache if this is a self-device operation
if (msg && element?.grayTipElement?.revokeElement.isSelfOperate) {
const cachedTimeout = this.recallEventCache.get(msg.msgId);
if (cachedTimeout) {
clearTimeout(cachedTimeout);
this.recallEventCache.delete(msg.msgId);
this.context.logger.logDebug('自操作消息撤回事件');
const isSelfDevice = this.recallEventCache.has(msg.msgId);
if (isSelfDevice) {
await this.core.eventWrapper.registerListen('NodeIKernelMsgListener/onMsgRecall',
(chatType: ChatType, uid: string, msgSeq: string) => {
return chatType === msg?.chatType && uid === msg?.peerUid && msgSeq === msg?.msgSeq;
}
).catch(() => {
msg = undefined;
this.context.logger.logDebug('自操作消息撤回事件');
});
}
}
if (msg && element) {
const recallEvent = await this.emitRecallMsg(msg, element);
try {