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

Function getTrollImage

dme/dme.ts:64–86  ·  view source on GitHub ↗

* 获取防撤回图片,支持缓存

()

Source from the content-addressed store, hash-verified

62 const dir = path.dirname(CONFIG.TROLL_IMAGE_PATH);
63 if (!fs.existsSync(dir)) {
64 fs.mkdirSync(dir, { recursive: true });
65 }
66
67 try {
68 const response = await fetch(CONFIG.TROLL_IMAGE_URL);
69 if (response.ok) {
70 const buffer = Buffer.from(await response.arrayBuffer());
71 fs.writeFileSync(CONFIG.TROLL_IMAGE_PATH, buffer);
72 return CONFIG.TROLL_IMAGE_PATH;
73 }
74 return null;
75 } catch (error) {
76 console.error("[DME] 下载防撤回图片失败:", error);
77 return null;
78 }
79}
80
81/**
82 * 带重试机制的删除消息函数
83 */
84async function deleteMessagesWithRetry(
85 client: TelegramClient,
86 chatEntity: any,
87 messageIds: number[],
88 retryCount: number = 0
89): Promise<number> {

Callers 2

Calls 1

errorMethod · 0.80

Tested by

no test coverage detected