MCPcopy Create free account
hub / github.com/Fibi66/FeiControl / getIntegrationStatus

Function getIntegrationStatus

src/app/api/system/route.ts:49–116  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

47}
48
49function getIntegrationStatus() {
50 const integrations = [];
51
52 // Telegram — read from openclaw.json (channels.telegram)
53 let telegramEnabled = false;
54 let telegramAccounts = 0;
55 try {
56 const openclawConfigPath = path.join(os.homedir(), '.openclaw', 'openclaw.json');
57 const openclawConfig = JSON.parse(fs.readFileSync(openclawConfigPath, 'utf-8'));
58 const telegramConfig = openclawConfig?.channels?.telegram;
59 telegramEnabled = !!(telegramConfig?.enabled);
60 if (telegramConfig?.accounts) {
61 telegramAccounts = Object.keys(telegramConfig.accounts).length;
62 }
63 } catch {}
64 integrations.push({
65 id: 'telegram',
66 name: 'Telegram',
67 status: telegramEnabled ? 'connected' : 'disconnected',
68 icon: 'MessageCircle',
69 lastActivity: telegramEnabled ? new Date().toISOString() : null,
70 detail: telegramEnabled ? `${telegramAccounts} bots configured` : null,
71 });
72
73 // Twitter (bird CLI) - check TOOLS.md for configuration
74 let twitterConfigured = false;
75 try {
76 const toolsPath = path.join(WORKSPACE_PATH, 'TOOLS.md');
77 const toolsContent = fs.readFileSync(toolsPath, 'utf-8');
78 twitterConfigured = toolsContent.includes('bird') && toolsContent.includes('auth_token');
79 } catch {}
80 integrations.push({
81 id: 'twitter',
82 name: 'Twitter (bird CLI)',
83 status: twitterConfigured ? 'configured' : 'not_configured',
84 icon: 'Twitter',
85 lastActivity: null,
86 detail: null,
87 });
88
89 // Google (gog/google-gemini-cli-auth) — check openclaw.json plugins
90 let googleConfigured = false;
91 let googleDetail: string | null = null;
92 try {
93 const openclawConfigPath = path.join(os.homedir(), '.openclaw', 'openclaw.json');
94 const openclawConfig = JSON.parse(fs.readFileSync(openclawConfigPath, 'utf-8'));
95 const gogPlugin = openclawConfig?.plugins?.entries?.['google-gemini-cli-auth'];
96 googleConfigured = !!(gogPlugin?.enabled);
97 if (googleConfigured) googleDetail = 'google-gemini-cli-auth plugin enabled';
98 } catch {}
99 // Fallback: check for gog config directory
100 if (!googleConfigured) {
101 try {
102 const gogPath = path.join(os.homedir(), '.config', 'gog');
103 googleConfigured = fs.existsSync(gogPath);
104 } catch {}
105 }
106 integrations.push({

Callers 1

GETFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected