Skip to content

Commit 0f506d4

Browse files
authored
Merge pull request #165 from alexhoshina/feat/onebot
feat: add OneBot channel support
2 parents 6ce7659 + 8cff6cf commit 0f506d4

File tree

4 files changed

+725
-0
lines changed

4 files changed

+725
-0
lines changed

config/config.example.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,14 @@
6060
"webhook_port": 18791,
6161
"webhook_path": "/webhook/line",
6262
"allow_from": []
63+
},
64+
"onebot": {
65+
"enabled": false,
66+
"ws_url": "ws://127.0.0.1:3001",
67+
"access_token": "",
68+
"reconnect_interval": 5,
69+
"group_trigger_prefix": [],
70+
"allow_from": []
6371
}
6472
},
6573
"providers": {

pkg/channels/manager.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,19 @@ func (m *Manager) initChannels() error {
163163
}
164164
}
165165

166+
if m.config.Channels.OneBot.Enabled && m.config.Channels.OneBot.WSUrl != "" {
167+
logger.DebugC("channels", "Attempting to initialize OneBot channel")
168+
onebot, err := NewOneBotChannel(m.config.Channels.OneBot, m.bus)
169+
if err != nil {
170+
logger.ErrorCF("channels", "Failed to initialize OneBot channel", map[string]interface{}{
171+
"error": err.Error(),
172+
})
173+
} else {
174+
m.channels["onebot"] = onebot
175+
logger.InfoC("channels", "OneBot channel enabled successfully")
176+
}
177+
}
178+
166179
logger.InfoCF("channels", "Channel initialization completed", map[string]interface{}{
167180
"enabled_channels": len(m.channels),
168181
})

0 commit comments

Comments
 (0)