(req dto.AgentTelegramConfigUpdateReq)
| 107 | } |
| 108 | |
| 109 | func (a AgentService) UpdateTelegramConfig(req dto.AgentTelegramConfigUpdateReq) error { |
| 110 | agent, install, err := a.loadAgentAndInstall(req.AgentID) |
| 111 | if err != nil { |
| 112 | return err |
| 113 | } |
| 114 | if agent.AgentType == constant.AppHermesAgent { |
| 115 | return updateHermesChannelConfig(agent, install, func(confDir string) error { |
| 116 | return writeHermesTelegramChannelConfig(confDir, dto.AgentTelegramConfig{ |
| 117 | Enabled: req.Enabled, |
| 118 | DmPolicy: req.DmPolicy, |
| 119 | AllowFrom: req.AllowFrom, |
| 120 | RequireMention: req.RequireMention, |
| 121 | GroupPolicy: req.GroupPolicy, |
| 122 | GroupAllowFrom: req.GroupAllowFrom, |
| 123 | Proxy: req.Proxy, |
| 124 | Streaming: req.Streaming, |
| 125 | DefaultAccount: req.DefaultAccount, |
| 126 | Bots: req.Bots, |
| 127 | }) |
| 128 | }) |
| 129 | } |
| 130 | return a.mutateAgentConfig(req.AgentID, func(_ *model.Agent, _ *model.AppInstall, conf map[string]interface{}) error { |
| 131 | setTelegramConfig(conf, dto.AgentTelegramConfig{ |
| 132 | Enabled: req.Enabled, |
| 133 | DmPolicy: req.DmPolicy, |
| 134 | AllowFrom: req.AllowFrom, |
| 135 | RequireMention: req.RequireMention, |
| 136 | GroupPolicy: req.GroupPolicy, |
| 137 | GroupAllowFrom: req.GroupAllowFrom, |
| 138 | Proxy: req.Proxy, |
| 139 | Streaming: req.Streaming, |
| 140 | DefaultAccount: req.DefaultAccount, |
| 141 | Bots: req.Bots, |
| 142 | }) |
| 143 | return nil |
| 144 | }) |
| 145 | } |
| 146 | |
| 147 | func (a AgentService) GetDiscordConfig(req dto.AgentIDReq) (*dto.AgentDiscordConfig, error) { |
| 148 | agent, _, err := a.loadAgentAndInstall(req.AgentID) |
nothing calls this directly
no test coverage detected