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

Function extractRoleChannelAccountIDs

agent/app/service/agents_agents.go:385–442  ·  view source on GitHub ↗
(conf map[string]interface{}, channel string)

Source from the content-addressed store, hash-verified

383}
384
385func extractRoleChannelAccountIDs(conf map[string]interface{}, channel string) []string {
386 switch channel {
387 case "feishu":
388 config := extractFeishuConfig(conf)
389 accountIDs := make([]string, 0, len(config.Bots))
390 for _, item := range config.Bots {
391 if accountID := item.AccountID; accountID != "" {
392 accountIDs = append(accountIDs, accountID)
393 }
394 }
395 sort.Strings(accountIDs)
396 return accountIDs
397 case "telegram":
398 config := extractTelegramConfig(conf)
399 accountIDs := make([]string, 0, len(config.Bots))
400 for _, item := range config.Bots {
401 if accountID := item.AccountID; accountID != "" {
402 accountIDs = append(accountIDs, accountID)
403 }
404 }
405 sort.Strings(accountIDs)
406 return accountIDs
407 case "discord":
408 config := extractDiscordConfig(conf)
409 accountIDs := make([]string, 0, len(config.Bots))
410 for _, item := range config.Bots {
411 if accountID := item.AccountID; accountID != "" {
412 accountIDs = append(accountIDs, accountID)
413 }
414 }
415 sort.Strings(accountIDs)
416 return accountIDs
417 case "qqbot":
418 config := extractQQBotConfig(conf)
419 accountIDs := make([]string, 0, len(config.Bots))
420 for _, item := range config.Bots {
421 if accountID := item.AccountID; accountID != "" {
422 accountIDs = append(accountIDs, accountID)
423 }
424 }
425 sort.Strings(accountIDs)
426 return accountIDs
427 case "dingtalk-connector":
428 config := extractDingTalkConfig(conf)
429 accountIDs := make([]string, 0, len(config.Bots))
430 for _, item := range config.Bots {
431 if accountID := item.AccountID; accountID != "" {
432 accountIDs = append(accountIDs, accountID)
433 }
434 }
435 sort.Strings(accountIDs)
436 return accountIDs
437 case "wecom":
438 return []string{}
439 default:
440 return extractRawChannelAccountIDs(getChannelConfig(conf, channel))
441 }
442}

Callers 1

GetRoleChannelsMethod · 0.85

Calls 7

extractFeishuConfigFunction · 0.85
extractTelegramConfigFunction · 0.85
extractDiscordConfigFunction · 0.85
extractQQBotConfigFunction · 0.85
extractDingTalkConfigFunction · 0.85
getChannelConfigFunction · 0.85

Tested by

no test coverage detected