feat(onebot): enhance OneBot channel#192
Open
alexhoshina wants to merge 4 commits intosipeed:mainfrom
Open
Conversation
…cription
Comprehensive improvements to the OneBot channel for better NapCatQQ
compatibility:
- Add echo-based API callback mechanism (sendAPIRequest) for
request/response correlation via pending map
- Add WebSocket ping/pong keepalive (30s ping, 60s read deadline)
- Fetch bot self ID via get_login_info on connect/reconnect
- Refactor parseMessageContentEx into parseMessageSegments supporting
image, record, video, file, reply, face, forward segments
- Add voice transcription via Groq transcriber (SetTranscriber)
- Switch to message segment array format for sending with auto reply
quote via lastMessageID tracking
- Add message_sent event handling and detailed notice event processing
(recall, poke, group increase/decrease, friend add, etc.)
- Use sync/atomic for echoCounter, optimize listen() lock pattern
- Clean up pending callbacks on Stop(), defer temp file cleanup
- Mount Groq transcriber on OneBot channel in main.go gateway
- Currently, the agent does not respond to messages sent by users outside the allowlist.
- onebot.go from 1179 to 980 lines (~17%)
Collaborator
|
@Zepan Enhanced OneBot channel implementation (+501/-206). OneBot was recently merged (#165) — this PR improves on that initial implementation. Recommendation: Review and merge. Follow-up improvements to a recently-merged channel are expected and welcome. The Chinese user community likely relies on QQ/OneBot. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概述
实现了对 OneBot 频道的全面增强,添加了富媒体支持、API 回调机制和语音转文字功能。
主要功能
媒体和富内容支持
API 回调系统
连接可靠性
语音转文字功能
消息处理改进
代码质量
Bug 修复
Overview
Implemented comprehensive enhancements to the OneBot channel, adding rich media support, an API callback mechanism, and voice transcription capabilities.
Key Features
Media and Rich Content Support
API Callback System
sendAPIRequest()for reliable command execution with timeout supportConnection Reliability
Voice Transcription Capability
Message Handling Improvements
parseMessageContentExinto context-awareparseMessageSegmentsCode Quality
sync.Mapfor message ID trackingstrings.HasPrefixBug Fixes
BotStatusparsing to handle both string and object-form status responsesisAPIResponse()to distinguish API responses from regular events