- platform-bridge: unified message model + Adapter interface - qq/adapter: OBv11 WebSocket protocol with @mention detection - telegram/discord: stub adapters with send capability - webhook: HTTP POST receiver for generic webhook integration - Router: message routing from platform → AI-Core → back - Group chat rules: 500 char limit, 3s gap, silence keywords - main.go: conditional adapter loading via env vars
22 lines
874 B
Go
22 lines
874 B
Go
package telegram
|
|
import (
|
|
"fmt"
|
|
"git.yeij.top/AskaEth/Cyrene_v2/services/platform-bridge"
|
|
)
|
|
type Config struct{ Name, Token string }
|
|
type Adapter struct {
|
|
cfg Config; incoming chan *bridge.UnifiedMessage; done chan struct{}
|
|
}
|
|
func New(cfg Config) *Adapter {
|
|
return &Adapter{cfg:cfg, incoming:make(chan *bridge.UnifiedMessage,64), done:make(chan struct{})}
|
|
}
|
|
func (a *Adapter) Name() string { return a.cfg.Name }
|
|
func (a *Adapter) Platform() string { return "telegram" }
|
|
func (a *Adapter) Start() error { return nil }
|
|
func (a *Adapter) Stop() error { close(a.done); return nil }
|
|
func (a *Adapter) Incoming() <-chan *bridge.UnifiedMessage { return a.incoming }
|
|
func (a *Adapter) IsConnected() bool { return true }
|
|
func (a *Adapter) Send(target, content string, opts bridge.SendOptions) error {
|
|
fmt.Printf("[tg:%s] -> %s: %s\n", a.cfg.Name, target, content); return nil
|
|
}
|