MCPcopy Create free account
hub / github.com/1Panel-dev/1Panel / UpdateDiscordConfig

Method UpdateDiscordConfig

agent/app/service/agents_channels.go:163–195  ·  view source on GitHub ↗
(req dto.AgentDiscordConfigUpdateReq)

Source from the content-addressed store, hash-verified

161}
162
163func (a AgentService) UpdateDiscordConfig(req dto.AgentDiscordConfigUpdateReq) error {
164 agent, install, err := a.loadAgentAndInstall(req.AgentID)
165 if err != nil {
166 return err
167 }
168 if agent.AgentType == constant.AppHermesAgent {
169 return updateHermesChannelConfig(agent, install, func(confDir string) error {
170 return writeHermesDiscordChannelConfig(confDir, dto.AgentDiscordConfig{
171 Enabled: req.Enabled,
172 DmPolicy: req.DmPolicy,
173 AllowFrom: req.AllowFrom,
174 RequireMention: req.RequireMention,
175 GroupPolicy: req.GroupPolicy,
176 Proxy: req.Proxy,
177 DefaultAccount: req.DefaultAccount,
178 Bots: req.Bots,
179 })
180 })
181 }
182 return a.mutateAgentConfig(req.AgentID, func(_ *model.Agent, _ *model.AppInstall, conf map[string]interface{}) error {
183 setDiscordConfig(conf, dto.AgentDiscordConfig{
184 Enabled: req.Enabled,
185 DmPolicy: req.DmPolicy,
186 AllowFrom: req.AllowFrom,
187 RequireMention: req.RequireMention,
188 GroupPolicy: req.GroupPolicy,
189 Proxy: req.Proxy,
190 DefaultAccount: req.DefaultAccount,
191 Bots: req.Bots,
192 })
193 return nil
194 })
195}
196
197func (a AgentService) GetQQBotConfig(req dto.AgentIDReq) (*dto.AgentQQBotConfig, error) {
198 agent, install, err := a.loadAgentAndInstall(req.AgentID)

Callers

nothing calls this directly

Calls 5

loadAgentAndInstallMethod · 0.95
mutateAgentConfigMethod · 0.95
setDiscordConfigFunction · 0.85

Tested by

no test coverage detected