chore: update dependencies and improve bot configuration

- Upgrade Go version to 1.24.0 and update toolchain.
- Update various dependencies in go.mod and go.sum, including:
  - Upgrade `fasthttp/websocket` to v1.5.12
  - Upgrade `fsnotify/fsnotify` to v1.9.0
  - Upgrade `valyala/fasthttp` to v1.58.0
  - Add new dependencies for `bytedance/sonic` and `google/uuid`.
- Refactor bot configuration in config.toml to support multiple bot protocols, including "milky" and "onebot11".
- Modify internal configuration structures to accommodate new bot settings.
- Enhance event dispatcher with metrics tracking and asynchronous processing capabilities.
- Implement WebSocket connection management with heartbeat and reconnection logic.
- Update server handling for bot management and event publishing.
This commit is contained in:
lafay
2026-01-05 00:40:09 +08:00
parent ac0dfb64c9
commit 44fe05ff62
30 changed files with 6311 additions and 182 deletions

View File

@@ -12,8 +12,41 @@ max_backups = 3
max_age = 7 # days
[protocol]
name = "onebot12"
name = "milky"
version = "1.0"
[protocol.options]
# OneBot12 specific options can be added here
# Protocol specific options can be added here
# ============================================================================
# Bot 配置
# ============================================================================
# Milky Bot 示例
[[bots]]
id = "milky_bot_1"
protocol = "milky"
enabled = false
[bots.milky]
protocol_url = "http://localhost:3000"
access_token = "your_token_here"
event_mode = "sse"
timeout = 30
retry_count = 3
# OneBot11 Bot 示例
[[bots]]
id = "onebot11_bot_1"
protocol = "onebot11"
enabled = true
[bots.onebot11]
connection_type = "ws"
self_id = "123456789"
nickname = "TestBot"
ws_url = "ws://127.0.0.1:3001"
access_token = "hDeu66@_DDhgMf<9"
timeout = 30
heartbeat = 30
reconnect_interval = 5