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

Function downloadChart

nezha/nezha.ts:392–416  ·  view source on GitHub ↗
(chartConfig: object)

Source from the content-addressed store, hash-verified

390 chart: chartConfig,
391 width: 800,
392 height: 400,
393 backgroundColor: "black",
394 format: "png",
395 },
396 {
397 responseType: "arraybuffer",
398 timeout: 30000,
399 headers: {
400 "Content-Type": "application/json",
401 },
402 }
403 );
404 return Buffer.from(response.data);
405 } catch (error: any) {
406 console.error("Failed to download chart:", error.message);
407 return null;
408 }
409}
410
411function getCountryFlag(code?: string): string {
412 if (!code) return "";
413 const flags: Record<string, string> = {
414 us: "🇺🇸", jp: "🇯🇵", hk: "🇭🇰", sg: "🇸🇬", kr: "🇰🇷", tw: "🇹🇼",
415 de: "🇩🇪", gb: "🇬🇧", fr: "🇫🇷", nl: "🇳🇱", au: "🇦🇺", ca: "🇨🇦",
416 cn: "🇨🇳", ru: "🇷🇺", in: "🇮🇳", br: "🇧🇷",
417 };
418 return flags[code.toLowerCase()] || "";
419}

Callers 1

nezhaFunction · 0.85

Calls 1

errorMethod · 0.80

Tested by

no test coverage detected