onebot: clean up comments, imports and whitespace

Remove extraneous comments, redundant explanatory notes and extra blank lines across onebot packages; reorder and normalize import lists in group-admin and group-album; remove unused comment blocks in event-converter. These are non-functional cleanup changes in packages/onebot/src/actions/extended.ts, packages/onebot/src/actions/group-admin.ts, packages/onebot/src/actions/group-album.ts and packages/onebot/src/event-converter/index.ts to improve readability and maintain consistent style.
This commit is contained in:
手瓜一十雪 committed 2026-05-24 13:08:24 +08:00
1 parent 245405d294
commit a52a9724cb
33 files changed
+213 -705

No files matched your search

-22
View File
@@ -3,18 +3,8 @@ import { convertEvent } from './event-converter';
import type { OneBotInstanceContext } from './instance-context';
import { GROUP_MESSAGE_EVENT, PRIVATE_MESSAGE_EVENT, hashMessageIdInt32 } from './message-id';
/**
* Subscribe every `OneBotInstanceContext`-aware handler onto the bridge
* event bus. Returns a disposer that removes every subscription registered
* here in one shot — useful for tests and for tearing down a session.
*/
export function registerEventPipeline(ctx: OneBotInstanceContext): () => void {
const disposers: Array<() => void> = [];
// Every kind that maps onto an OB11 message event also seeds the
// message-meta cache; we do that synchronously before async conversion so
// reply / quote lookups for that message id work even if the converter
// takes a beat to finish (e.g. while resolving image URLs).
disposers.push(
ctx.bridge.events.on('group_message', async (event) => {
cacheGroupMessageMeta(ctx, event);
@@ -33,15 +23,9 @@ export function registerEventPipeline(ctx: OneBotInstanceContext): () => void {
await convertAndDispatch(ctx, event);
}),
);
// Notice / request / non-message events: no meta caching needed, just
// convert and dispatch.
for (const kind of NOTICE_KINDS) {
disposers.push(
ctx.bridge.events.on(kind, async (event) => {
// Side-effect: write emoji-reaction events to the local cache
// BEFORE converting / dispatching, so a fetch_emoji_like that
// races with the push still sees the new row.
if (event.kind === 'group_msg_emoji_like') {
cacheReaction(ctx, event);
}
@@ -116,12 +100,6 @@ function cacheReaction(
ctx: OneBotInstanceContext,
event: Extract<QQEventVariant, { kind: 'group_msg_emoji_like' }>,
): void {
// `isAdd=true` means the operator just reacted; `isAdd=false` means
// the reaction was withdrawn. The decoder already normalizes both
// directions onto this single event kind. `emojiType` isn't on the
// push event payload — we default to 1 (QQ-face) which matches every
// observed reaction so far; the field is a known unknown and can be
// refined later if a wire dump shows it.
if (!event.groupId || !event.msgSeq || !event.emojiId || !event.operatorUin) return;
if (event.isAdd) {
ctx.reactionStore.recordAdd(