MCPcopy Create free account
hub / github.com/TeleBoxOrg/TeleBox_Plugins / parseArgs

Method parseArgs

rate/rate.ts:324–335  ·  view source on GitHub ↗
(args: string[])

Source from the content-addressed store, hash-verified

322 const curr: string[] = [];
323 for (const t of tokens) {
324 const n = parseFloat(t);
325 if (!isNaN(n) && isFinite(n)) amount = n; else curr.push(t);
326 }
327 const base = curr[0] || 'btc';
328 const quote = curr[1] || 'usd';
329 return { base, quote, amount };
330 }
331
332 // (新) 获取币安价格
333 private async fetchBinancePrice(symbol: string): Promise<number> {
334 try {
335 const url = `https://api.binance.com/api/v3/ticker/price?symbol=${symbol.toUpperCase()}`;
336 const { data } = await axios.get(url, { timeout: 5000 });
337 if (data && data.price) {
338 return parseFloat(data.price);

Callers 1

handleRateMethod · 0.95

Calls 1

normalizeCodeMethod · 0.95

Tested by

no test coverage detected