34 lines
614 B
Go
34 lines
614 B
Go
package channel
|
|
|
|
import (
|
|
"context"
|
|
"log/slog"
|
|
|
|
"git.db123.ir/db123/divacode/internal/agent"
|
|
"git.db123.ir/db123/divacode/internal/config"
|
|
)
|
|
|
|
type MatrixClient struct {
|
|
cfg *config.Config
|
|
agent *agent.Agent
|
|
}
|
|
|
|
func NewMatrixClient(cfg *config.Config, a *agent.Agent) *MatrixClient {
|
|
return &MatrixClient{
|
|
cfg: cfg,
|
|
agent: a,
|
|
}
|
|
}
|
|
|
|
func (mc *MatrixClient) Start(ctx context.Context) error {
|
|
if !mc.cfg.MatrixEnabled {
|
|
slog.Info("matrix channel disabled")
|
|
return nil
|
|
}
|
|
slog.Info("matrix client connecting",
|
|
"homeserver", mc.cfg.MatrixHomeserver,
|
|
"user", mc.cfg.MatrixUser,
|
|
)
|
|
return nil
|
|
}
|